Hacker News new | ask | show | jobs
by derriz 444 days ago
"Why does JavaScript get some much hate?"

I don't get it either? I've only used it occasionally but it has always struck me as a really impressive example of what can be built on minimal (minimalist?) foundations. Its semantics can understood in 5 minutes.

It reminds me of Scheme in this regard. Writing an interpreter or compiler for it would be easily within reach of an undergraduate student. Contrast with other currently popular (more respected?) languages like Rust, C++, Java, C# or even Python.

I've only recently been expose to Typescript and again, I'm really impressed. I haven't encountered a type system so elegant and orthogonal since first being exposed to ML like languages.

1 comments

> Its semantics can understood in 5 minutes.

Your definition of "semantics" must be different from mine, or you perhaps haven't seen https://javascriptwtf.com/ (linked in a sibling comment)

Your comment actually made me wonder whether those cited artifacts were implementation bugs or actually in the specification and ... lol, this shit reminds me of people who put comments above functions that just restate the function's name: https://tc39.es/ecma262/2024/#sec-addition-operator-plus

> Writing an interpreter or compiler for it would be easily within reach of an undergraduate student

Surely you don't really believe that? Or is the rest of the sentence "... eventually, over the course of their undergraduate career"

The 15th edition of the standard is 816 pages and now includes specifying the Memory Model. What I suspect you mean is "could write a parser for the 1st edition spec from 1997"

I'm claiming that its semantics are simple, not that they've made great choices in the design of the language. For example, I've barely used Javascript, but I think I would have scored fairly highly if that javascriptwft page was turned into a quiz. Most of the examples are fairly transparent once you know the implicit casting rules. I've read certain wtfs associated with C++ or even Java far more puzzling despite years of experience with them.

And yes I do believe that writing an interpreter for Javascript would be no more difficult than doing one for Scheme (which I had to do as a student) - the parser would be more difficult admittedly.

I can find oddities like this in all languages. Arguably C and C++ have more warts, particularly C++ where I always hear people talk about how it’s only reasonable to use a small subset of the language. Also how C/C++ compilers don’t all support the same features of the purported language they compile.

I won’t argue that JS doesn’t have warts - it does and if it wasn’t for backward compatibility I imagine they’d have been removed from the language - but the entries on that website are quite small compared to others - like C and C++ - that I can think of