News for hackers. Stuff that matters.
Re:Why is the JavaScript ecosystem like this by PaulHoule on Wednesday January 04, 2023 @03:29PM (#34251012)
Can't you have more than one node.js installed?
Re:Why is the JavaScript ecosystem like this by dbmikus on Wednesday January 04, 2023 @03:37PM (#34251144)
Re:Why is the JavaScript ecosystem like this by amalgamated_inc on Wednesday January 04, 2023 @03:46PM (#34251271)
`asdf` allows this for all languages, not just Node, one stop shop.

That said, yea, the JS ecosystem is literal cancer.

Re:Why is the JavaScript ecosystem like this by 8note on Wednesday January 04, 2023 @04:33PM (#34252050)
There is something really special about that cancer.

It's the only language I've written in where no matter what code I'm writing, I can always think "this could be fully generalized and spun out into a package"

Re:Why is the JavaScript ecosystem like this by seanw444 on Wednesday January 04, 2023 @04:11PM (#34251708)
I find it hilarious that JS was basically invented overnight, and ever since, it's just been layers of hodgepodge added and held together with hot glue to make it all work. And now it's the most popular programming language in the world, even outside of its original intended domain.

How we got ourselves here, I don't know.

Re:Why is the JavaScript ecosystem like this by WorldMaker on Wednesday January 04, 2023 @04:42PM (#34252190)
Most programming languages have underwhelming origin stories and are evolutionary hodgepodges held together with hot glue.

The most likely opposite to "basically invented overnight" is "designed by committee", and is that much preferable?

Origin stories aren't the end of the story either. Humble origins aside, JS has had many of the best minds in many of the largest companies contribute all sorts of feature work and performance efforts across a span of decades. How many languages can claim that many eyeballs and that diverse a set of language developers and engine writers?

Sure, a lot of it looks like a hodgepodge, especially with its mandatory, deep respect for backward compatibility, because no one wants to break an old website. But show me the language with any respect for backward compatibility that doesn't look like a hodgepodge?

Core systems languages like C and C++ started out as intentional hodgepodges. Their macro system was originally its own, different, language brought in from another existing project for some temporary duty, and now enshrined in the language as a forever feature.

Hodgepodges are how languages are built and evolved. That's how we got ourselves here: the natural way. Every programming language on the planet is its own beautiful house of cards, built piece at a time. Don't just look down on JS because it went "mainstream".

Re:Why is the JavaScript ecosystem like this by PaulHoule on Wednesday January 04, 2023 @05:21PM (#34252737)
Common Lisp and Java were two of the first languages designed by adults and they broke those trends.
Re:Why is the JavaScript ecosystem like this by amalgamated_inc on Wednesday January 04, 2023 @05:40PM (#34252967)
I've never used CL but heard it's very "design by committee." Java is worse than JS. So yea, maybe hodge podge is actually the best option we have.
Re:Why is the JavaScript ecosystem like this by WorldMaker on Wednesday January 04, 2023 @10:18PM (#34255451)
Yeah, the "Common" in Common Lisp comes from committee. Lisp itself was a "basically designed overnight" language that became an incredibly popular hodge podge of a million snowflake variants and then eventually two competing attempts to standardize and clean up the hodge podge happened: Scheme (to my understanding a BFDL-like situation of a strong figure building anew, with few backwards compatibility cares) and Common Lisp (a standards committee and then some, with a bunch of backwards compatibility shenanigans to sort out).

(ETA: I am a fan of Common Lisp, for what that is worth, if this sounds too critical. It's a very nice language. Some of what has made it nice was a massive committee and standards effort, very similar to the way JS has continued to evolve under TC-39 stewardship.)

Also yeah, my impression of Java was that it was very design-by-committee.

Re:Why is the JavaScript ecosystem like this by lispm on Thursday January 05, 2023 @04:13AM (#34257645)
> Lisp itself was a "basically designed overnight" language

Roughly "overnight" for six years:

http://jmc.stanford.edu/articles/lisp/lisp.pdf

Re:Why is the JavaScript ecosystem like this by WorldMaker on Thursday January 05, 2023 @03:09PM (#34265789)
Per that own history, the first version "Lisp 1" was written as a project in a single University semester. Compared to the many committee years of, for instance, ALGOL, that is "basically overnight" by comparison.
Re:Why is the JavaScript ecosystem like this by lispm on Thursday January 05, 2023 @03:40PM (#34266222)
The implementation of the first and relatively primitive version took roughly a year. McCarthy had two full-time programmers and six graduate students working for him.
Re:Why is the JavaScript ecosystem like this by krapp on Wednesday January 04, 2023 @04:21PM (#34251853)
It was the first programming language available to the general public that was easy enough for the public to use without a CS education - and it running on the web made it ubiquitous.

Then SV happened, and the web became Serious Business. Then Node.js happened and Javascript became Serious Business, and with that came the byzantine horror of complexity necessary to get a toy scripting language invented in a week to replace every enterprise programming language in existence because managers could toss a rock out of their office window and it would bounce off of three web devs before hitting the ground.

Re:Why is the JavaScript ecosystem like this by Sohcahtoa82 on Wednesday January 04, 2023 @05:07PM (#34252569)
> It was the first programming language available to the general public that was easy enough for the public to use without a CS education - and it running on the web made it ubiquitous.

BASIC would like a word.

Heck, even Python came 4 years before JS.

Re:Why is the JavaScript ecosystem like this by krapp on Wednesday January 04, 2023 @05:20PM (#34252725)
Javascript was still easier to use and more readily available than either of those.
Re:Why is the JavaScript ecosystem like this by Sohcahtoa82 on Wednesday January 04, 2023 @11:12PM (#34255854)
Debatable.

I find JavaScript's type system to be horrendous and bug prone. I'd rather operations between two types that don't make sense (like dividing an Array by an Object) to throw an explicit error than to just do some unpredictable shit that causes a subtle bug.

Also, BASIC is probably the easiest language to learn, though this is mostly because it lacks capabilities that create complexities. It's a completely obsolete language.

Re:Why is the JavaScript ecosystem like this by amalgamated_inc on Thursday January 05, 2023 @11:32AM (#34262313)
Probably a generational thing. I learned BASIC, but when I was a kid, I had not internet, no phone, and no browser.

Nowadays everyone has 10 JavaScript interpreters in every device, so it's much more accessible than finding out about and installing BASIC.

BASIC also lost all relevance in terms of actually being useful (if it ever had it), whereas JS is the bee's knees.

Re:Why is the JavaScript ecosystem like this by ElectricalUnion on Thursday January 05, 2023 @11:49AM (#34262621)
> Also, COBOL is probably the easiest language to learn, is mostly Just English. /s

FTFY.

Re:Why is the JavaScript ecosystem like this by salawat on Wednesday January 04, 2023 @03:55PM (#34251430)
You're going to have to wipe out package-lock.json or whatever your lockfile is and recompute from scratch. I tend to squirrel away a backup just in case whenever I touch JS dependencies because I've been bitten by yarn/npm/pnpm bs too many times. Also make sure you wipeout all your node_modules, plus your yarn/pnpm cache. Technically, you should only do dependency manipulation sith p?npm|yarn add|remove, to get lockfile recalculation, but depending on version of those tools there are so many quirks you have to watch out for.

I always approach any library upgrade as a potential disaster that'll result in me having to nuke my entire node setup for that project and rebuild it from the ground up or last known good state. I never had the kinds of problems I have with JS with any other bloody languages and their respective build tools.

Re:Why is the JavaScript ecosystem like this by kavaruka on Wednesday January 04, 2023 @04:07PM (#34251625)
This is an old issue; the ecosystem has changed.

Now, using the "engine" and "packageManages" properties, you can bind your project to a particular runtime version and package manager.

Re:Why is the JavaScript ecosystem like this by pwdisswordfish9 on Wednesday January 04, 2023 @04:30PM (#34251999)
> I never had the kinds of problems I have with JS with any other bloody languages and their respective build tools.

That's interesting, ECMA-262 doesn't say anything about package lock files or node_modules. I also run dozens or hundreds of programs every day that don't have these kinds of problems--in fact, the browser-based apps I use never have these problems, ever.

Are you sure you're not confusing JS with something else? Sounds like a problem with that p?npm|yarn thing (whatever that is).

Re:Why is the JavaScript ecosystem like this by salawat on Wednesday January 04, 2023 @04:50PM (#34252330)
The tools in question are

npm (Node Package Manager) pnpm being a modified version thereof that adds a compression/content addressible store mechanism to speed things up in a development configuration. Or Yarn

...which is yet another dependency management solution cum build tool, which is Maven/Gradle like. Depending on version though there are so many quirks. Both are "staples" of any enterprise scale project I've run into.

I don't have an issue with nodeJS or JS per se. It's the ecosystem and enterprise tooling. I still cannot for certain say those damn build tools don't muck things up in horribly subtle ways, and the experience of debugging the average horrible nest of every dependency known to man has comsumed entirely too much of my life, and the experience overcoming that learning curve I still can't say with confidence wasn't somewhat deleterious to my personal sanity.

I can do it trivially now; and I can appreciate the things you can build with it when doing it correctly. The depth of hole you can quickly end up in though is not to be underestimated.

That and nigh every JS developer I've run into who says they are proficient knows nothing about really debugging it, or hasn't read the core library docs and really means they can use one framework or another.

...Bar like 3. Who you never want to bother, because they are usually handling issues way more important/wide-ranging that warrant their attention than hand-holding you through learning how it actually works.

Re:Why is the JavaScript ecosystem like this by pwdisswordfish9 on Thursday January 05, 2023 @08:57AM (#34259576)
If you "don't have an issue" with JavaScript but you think the tools you're using are bad because of the "depth of hole you can quickly end up in though is not to be underestimated", then perhaps you should reconsider your decision to continue using them when you're writing JS and why you ever thought they were necessary.

None of those things (package-lock.json, node_modules, or p?npm|yarn) actually come from ECMA-262...

Re:Why is the JavaScript ecosystem like this by ElectricalUnion on Thursday January 05, 2023 @11:55AM (#34262715)
> I've been bitten by (...) pnpm bs too many times.

I'm surprised, the only node package manager that has any semblance of sanity is pnpm.

No flattening BS. Not randomly adding extraneous undeclared dependencies on the dependency tree. Not allowing random dependencies to depend on extraneous undeclared dependencies on the dependency tree.

Of course, then you find out that in the real life people actually use other package managers, and depend on non-deterministic, package flattening behavior and extraneous undeclared dependencies requiring extraneous undeclared dependencies...