Live data from Hacker News

Should JavaScript be split into two languages?

devclass.com

251–260 of 324 posts

Re: Should JavaScript be split into two languages?

#251
post #219

Earlier quoted context omitted.

I think it’s much harder to make big leaps as a community with languages and other - relative to the technology stack as a whole - lower level concerns. Look at the stronghold grip of C/C++ and how long it’s taken Rust to gain a meaningful foothold in those realms for example. Google wanted to flat replace JS once already, that was the entire origin of Dart. They only pivoted to the cross platform mobile framework as…

Dart is a better designed language in many regards.

It’s not just better than JavaScript, I would argue it’s probably the best general purpose modern OOP based language out there right now.

It was actually really fortunate in that for a long time it didn’t have a big community behind it and they just put a lot of very smart language designers on the team where they had ten years to try various approaches and learn from the mistakes of not only themselves but others without a lot of outside noise.

But there’s no other language I would prefer to write applications in. It’s just a really nice mix of ergonomic, expressive and powerful.

Re: Should JavaScript be split into two languages?

#252
post #242
post #239

Earlier quoted context omitted.

> it’s just a standard s-expression syntax I.e. they are correct that it is arcane. What percentage of programmers today do you think have ever seen code written in any Lisp dialect, let alone understand it?

I wonder what the response would've been if I had left the WAT source code out and just claimed, "this WASM binary was built with a compiler", and not specified the language.

i would have liked to see the source. how would the example look like when written in python for example? and how would it compare with non-wasm javascript?

Re: Should JavaScript be split into two languages?

#253

> Regarding BigInt, the presentation states that “use cases never materialized.” Yet every language has either that or BigDecimal. Even if Google's frontend devs haven't found a use, there also exist JS devs outside of Google who certainly have found uses (though possibly more of them on the backend). Similarly, not every developer has a compilation step in their JS work. And there are places where you can't have one…

I used BigInt to implement xxhash recently.

Re: Should JavaScript be split into two languages?

#254

I'm a little annoyed that they said Bigint uses cases never materialized. I've used it several times and it isn't something that's easy to transpile. A bigint class has bad ergonomics and there's no way the perf can be equivalent.

It’s because Google doesn’t use Node.js or any JS outside the browser, so they assume low browser usage is low usage in general which isn’t true.

https://github.com/search?q=BigInt+language%3ATypeScript&typ...

https://github.com/search?q=BigInt+language%3AJavaScript&typ...

Re: Should JavaScript be split into two languages?

#255
post #239

Earlier quoted context omitted.

[flagged]

> it’s just a standard s-expression syntax I.e. they are correct that it is arcane. What percentage of programmers today do you think have ever seen code written in any Lisp dialect, let alone understand it?

What percentage of programmers on Hacker News haven't?

Flaunting your ignorant anti-intellectualism isn't a good look.

You do know this is 2024, you have Internet access, and you can just look shit up or ask ChatGPT to learn new things, instead of cultivating ignorance and pointlessly criticising programmers trying to raise awareness, share their experiences, and educate themselves and other people.

In case you've been living under a rock and didn't realize it, JavaScript, the topic of this discussion, is essentially a dialect of Lisp, with garbage collection, first class functional closures, polymorphic JSON structures instead of s-expressions, a hell of a lot more like and inspired by Lisp and Scheme than C++, and LOTS of people know it.

Re: Should JavaScript be split into two languages?

#256

I'd argue that other languages did this (or something similar) to great success, most notably Java. That is, the Hotspot VM was such a phenomenal engine that lots of other languages sprung up to take advantage of that: Closure, Scala, Kotlin, etc.: https://en.m.wikipedia.org/wiki/List_of_JVM_languages . Even with the Java language itself, syntactic changes happen much more frequently than VM-level bytecode changes. W…

It seems to me that wasm should just support the web/browser API instead of the current trampoline business; this way, JS build tooling can emit wasm files, which is similar to the example you use.

no, people need to be able to program the browser without needing “tooling”

Re: Should JavaScript be split into two languages?

#257
post #200

Earlier quoted context omitted.

[flagged]

> Thanks for your simple concrete examples and explanations! I'm glad someone liked it :-) > I love his description of Forth as "a weird backwards lisp with no parentheses" I've been interested in that duality between Forth and Lisp before, but my progression always seems to following this path: - Since Forth is just Lisp done backwards and without parens, and since it's not hard to write an sexpr parser, I might as…

PostScript is kind of like a cross between Forth and Lisp, but a lot more like Lisp actually. And its data structures, which also represent its code, are essentially s-expressions or JSON (polymorphic dicts, arrays, numbers, booleans, nulls, strings, names (interned strings), operators (internal primitives), etc.)

https://donhopkins.medium.com/the-shape-of-psiber-space-octo...

Not coincidentally, James Gosling designed the NeWS window system and implemented its PostScript interpreter, years before designing and implementing Java. And before that he designed and implemented "MockLisp" in his Unix version of Emacs, which he self effacingly described like: "The primary (some would say only) resemblance between Mock Lisp and any real Lisp is the general syntax of a program, which many feel is Lisp's weakest point."

https://news.ycombinator.com/item?id=29954778

James Gosling's Emacs Mocklisp was like FEXPRs on PCP, with support for prompting the user to supply omitted arguments.

https://news.ycombinator.com/item?id=14312249

DonHopkins on May 10, 2017 | parent | context | favorite | on: Emacs is sexy

Hey at least Elisp wasn't ever as bad as Mock Lisp, the extension language in Gosling (aka UniPress aka Evil Software Hoarder) Emacs.

It had ultra-dynamic lazy scoping: It would defer evaluating the function parameters until they were actually needed by the callee (((or a function it called))), at which time it would evaluate the parameters in the CALLEE's scope.

James Gosling honestly copped to how terrible a language MockLisp was in the 1981 Unix Emacs release notes:

https://archive.org/stream/bitsavers_cmuGosling_4195808/Gosl

    12.2. MLisp - Mock Lisp 

    Unix Emacs contains an interpreter for a language 
    that in many respects resembles Lisp. The primary 
    (some would say only) resemblance between Mock Lisp
    and any real Lisp is the general syntax of a program, 
    which many feel is Lisp's weakest point. The 
    differences include such things as the lack of a 
    cons function and a rather peculiar method of 
    passing parameters. 
"Rather peculiar" is an understatement. More info, links and code examples:

https://news.ycombinator.com/item?id=8727085

Comparison of PostScript with Forth and Lisp:

https://news.ycombinator.com/item?id=22456471

[...]

PostScript is much higher level than Forth, and a lot more like Lisp than Forth, and has much better data structures than Forth, like polymorphic arrays (that can be used as code), dictionaries (that can be used as objects), strings, floating point numbers, and NeWS "magic dictionaries" that can represent built-in objects like canvases, processes, events, fonts, etc.

Yet Forth doesn't even have dynamically allocated memory, although in a few pages of code you can implement it, but it's not standard and very few Forth libraries use it, and instead use the linear Forth dictionary memory (which is terribly limited and can't be freed without FORGETting everything defined after you allocated it):

https://donhopkins.com/home/archive/forth/alloc.f

PostScript is homoiconic. Like Lisp, PostScript code IS first class PostScript data, and you can pass functions around as first class objects and call them later.

https://en.wikipedia.org/wiki/Homoiconicity

[...]

Re: Should JavaScript be split into two languages?

#258
post #239

Earlier quoted context omitted.

> it’s just a standard s-expression syntax I.e. they are correct that it is arcane. What percentage of programmers today do you think have ever seen code written in any Lisp dialect, let alone understand it?

What percentage of programmers on Hacker News haven't? Flaunting your ignorant anti-intellectualism isn't a good look. You do know this is 2024, you have Internet access, and you can just look shit up or ask ChatGPT to learn new things, instead of cultivating ignorance and pointlessly criticising programmers trying to raise awareness, share their experiences, and educate themselves and other people. In case you've be…

My point is that if someone says something is arcane, “it’s not, it’s just [something that you’ve potentially never heard of and almost definitely don’t understand even if you have heard of it]” doesn’t help your case. They could look it up, but the fact that they would have to do so proves the commenter’s point - relatively few programmers understand Lisp syntax, i.e. it is arcane.

If you’re trying to raise awareness of something, don’t act like the reader is stupid if they don’t already understand. Insisting that something is obvious, especially when it is not, means any reader who does not understand it will likely perceive the comment as snobby. As does including snide remarks such as “in case you’ve been living under a rock”.

> Flaunting your ignorant anti-intellectualism isn’t a good look.

Why do you assume that I personally don’t know what s-expressions are just because I agree that they’re arcane? Labelling someone as an ignorant anti-intellectual just because they disagree with something you said isn’t a good look either.

Re: Should JavaScript be split into two languages?

#259
post #221

Earlier quoted context omitted.

The vanilla js APIs are so atrocious that we got jquery.

I think you missed a tense. Was atrocious, we got jquery, which got folded back into javascript. If the last time you worked with vanilla js was when jquery was hot, you're views are outdated.

Sibling and parent/child traversal is still a disaster and querySelector, querySelectorAll doesn't solve it.

Re: Should JavaScript be split into two languages?

#260

This sounds like a crock of shit. No, it won't be faster, if you only optimize a lesser language. If you have higher level code running your optimizer can do more than if it only has a low level version. No, it won't be more secure. Js0 might be more secure, but if we sites all run any of dozens of different tools those tools are going to be creating the vulnerabilities. It's shifting where security issues occur, and…

JS0 is supposed to be a high level language. Theoretically it could improve performance by allowing more explicitness in the generated code than in normal JS, thus helping out the JIT optimizer.

I don't see how a browser running JS0 can be any less secure than a browser running JS

Post reply on HN