News for hackers. Stuff that matters.
Re:Go's Sweet 16 by morshu9001 on Friday November 14, 2025 @07:23PM (#45933825)
This is also what I like about JS, except it's even easier than Go. Meanwhile Python has a surprising number of random features.
Re:Go's Sweet 16 by alexjplant on Friday November 14, 2025 @07:56PM (#45934072)
ECMAScript is an order of magnitude more complicated than Go by virtually every measure - length of language spec, ease of parsing, number of context-sensitive keywords and operators, etc.
Re:Go's Sweet 16 by ttoinou on Friday November 14, 2025 @10:27PM (#45934799)
Yeah I’m pretty sure people who say JS is easy don’t know about its Prototype based OOP
Re:Go's Sweet 16 by morshu9001 on Saturday November 15, 2025 @12:53PM (#45939199)
You don't have to know about it, but if you do, it's actually simpler than how other languages do OOP.
Re:Go's Sweet 16 by gf000 on Saturday November 15, 2025 @04:36PM (#45940780)
Not convinced. Especially with property flags.
Re:Go's Sweet 16 by liveoneggs on Saturday November 15, 2025 @01:45PM (#45939591)
strict mode makes it okay
Re:Go's Sweet 16 by woodruffw on Friday November 14, 2025 @07:56PM (#45934074)
I think JS is notoriously complicated: the phrase “the good parts” has broad recognition among programmers.
Re:Go's Sweet 16 by jchw on Friday November 14, 2025 @07:27PM (#45933867)
Just so we're on the same page, this is the current JS spec:

https://262.ecma-international.org/16.0/index.html

I don't agree. (And frankly don't like using JS without at least TypeScript.)

Re:Go's Sweet 16 by goranmoomin on Saturday November 15, 2025 @11:02AM (#45938301)
While I might not think that JS is a good language (for some definition of a good language), to me the provided spec does feel pretty small, considering that it's a language that has to be specified to the dot and that the spec contains the standard library as well.

It has some strange or weirdly specified features (ASI? HTML-like Comments?) and unusual features (prototype-based inheritance? a dynamically-bounded this?), but IMO it's a small language.

Re:Go's Sweet 16 by jchw on Saturday November 15, 2025 @03:52PM (#45940526)
Shrugging it off as just being large because it contains the "standard library" ignores that many JS language features necessarily use native objects like symbols or promises, which can't be entirely implemented in just JavaScript alone, so they are intrinsic rather than being standard library components, akin to Go builtins rather than the standard library. In fact, in actual environments, the browser and/or Node.JS provide the actual standard library, including things like fetch, sockets, compression codecs, etc. Even ignoring almost all of those bits though, the spec is absolutely enormous, because JavaScript has:

- Regular expressions - not just in the "standard library" but in the syntax.

- An entire module system with granular imports and exports

- Three different ways to declare variables, two of which create temporal dead zones

- Classes with inheritance, including private properties

- Dynamic properties (getters and setters)

- Exception handling

- Two different types of closures/first class functions, with different binding rules

- Async/await

- Variable length "bigint" integers

- Template strings

- Tagged template literals

- Sparse arrays

- for in/for of/iterators

- for await/async iterators

- The with statement

- Runtime reflection

- Labeled statements

- A lot of operators, including bitwise operators and two sets of equality operators with different semantics

- Runtime code evaluation with eval/Function constructor

And honestly it's only scratching the surface, especially of modern ECMAScript.

A language spec is necessarily long. The JS language spec, though, is so catastrophically long that it is a bit hard to load on a low end machine or a mobile web browser. It's on another planet.

Re:Go's Sweet 16 by morshu9001 on Thursday November 20, 2025 @12:41AM (#45989332)
Yeah, a lot of the quirks come from it being small
Re:Go's Sweet 16 by ajross on Friday November 14, 2025 @08:12PM (#45934155)
The Javascript world hides its complexity outside the core language, though. JS itself isn't so weird (though as always see the "Wat?" video), but the incantations required to type and read the actual code are pretty wild.

By the time you understand all of typescript, your templating environment of choice, and especially the increasingly arcane build complexity of the npm world, you've put in hours comparable to what you'd have spent learning C# or Java for sure (probably more). Still easier than C++ or Rust though.

Re:Go's Sweet 16 by xigoi on Saturday November 15, 2025 @07:48AM (#45937082)
…do you know you can just write JavaScript and run it in the browser? You don’t need TypeScript, NPM or build tools.
Re:Go's Sweet 16 by throwaway894345 on Saturday November 15, 2025 @09:11AM (#45937592)
You do if you want more than one file, or if you want to use features that a user’s target browser may not support.
Re:Go's Sweet 16 by xigoi on Saturday November 15, 2025 @09:20AM (#45937635)
> You do if you want more than one file

Modules were added in, like, 2016.

Re:Go's Sweet 16 by morshu9001 on Sunday November 16, 2025 @02:03AM (#45943330)
nodejs and npm are easy for beginners, especially compared to the Python packaging situation
Re:Go's Sweet 16 by legends2k on Friday November 14, 2025 @08:36PM (#45934275)
Sorry, hard disagree. Try to understand what `this` means in JS in its entirety and you'll agree it's by no stretch of the imagination a simple language. It's more mind-bending and hence _The Good Parts_.
Re:Go's Sweet 16 by cratermoon on Friday November 14, 2025 @09:09PM (#45934432)
Re:Go's Sweet 16 by llmexperience on Friday November 14, 2025 @09:25PM (#45934521)
Tell me you have no idea what you’re talking about without explicitly saying the phrase.