Until recently it was quite the absolute worst experience of software ever for me and I used DOS and Windows 1.0.
Every time I realized I had to use npm I would be filled with deep dread and the knowledge that I was about to have my time burned in a bonfire of errors, confusion and complexity.
Someone needs to make a sincere apology for npm.
Why has it not bothered me lately? Either it has been improved or I am using it differently somehow.
Try Haskell or an ML. Heck, even C# isn't that bad these days.
JavaScript's just a minefield of pitfalls. To be fair, it was designed in 10 days, and progress on it has been slow to say the least. (Hence the silly crap like having a "left-pad" thing as a 3rd party "module" instead of part of a proper stdlib.)
Other stuff like using "function" as the lambda identifier just make me shake my head. Or not having integers. Just poor decisions all around.
Generally, unless you're doing systems or realtime programming, or you are writing a serious fast path for a lot of data, the only reason you'd need more than the very basic features present in every programming language is that you're trying to do something more complicated than you should be.
Many programmers seem willing to take on almost any amount of complexity in their toolchain if it will allow them to express an idea in a slightly more concise way. I would prefer to stay much closer to the basics and just take the time to make really beautiful and powerful functions, rather than rely on a rickety stack of concepts that, if not confusing to me, will be confusing to many of the people who end up interacting with my code.
== vs ===
No integers.
Assignment is declaration.
Prototypes.
Curly brackets & semicolons.
Semicolon insertion.
It may be flexible (in the sense that an Alfa Romeo driven into a telephone pole at 120 mph is flexible), but it sure as heck ain't effective. JavaScript is the great shame of the computing industry: that it exists, and that it is used, and that it is used in more than just the browser, is an indictment of our entire profession.
JavaScript: take off and nuke it from orbit. It's the only way to be sure.
JavaScript: you'll envy the dead.
JavaScript: a mistake, carried out past the point of absurdity.
And that is good.
With things like rust and go backing us up in places where more verbose and static code is beneficial (for performance?) we are finally entering new age which leaves closed corp-controlled "enterprise" things (java, net - looking at you) behind.
Fair enough.
> Assignment is declaration.
Not exactly. You can declare variables separately, if you want. In fact, a "var x = 42" statement will actually be split into "var x;" at the top of the scope and "x = 42" wherever you actually wrote it by the interpreter. The specified behaviour is a little weird and non-obvious, but once you know it, you know it.
> Prototypes.
That's a matter of taste (plus the problem of optimisation at the VM level, admittedly). Besides which, you can basically use prototypes to do classes, if that's your bag, and of course we have class syntax now anyway.
> Curly brackets & semicolons.
Semicolons are optional, which however you complain about below. So are some curly braces. The only alternative to having some kind of block delimiter would be significant whitespace, which is a perfectly legitimate preference but has its own warts.
> Semicolon insertion.
Around which the rules are fairly simple to understand. It's possible there's just a better way to do it (I know Go has ASI, for instance, but have never heard anyone complain).
---
I find this a most peculiar list of JS warts (what, not even a shout out for ==, bizarre implicit type coercions, etc?) There's no doubt it is a deeply flawed language, a big part of learning it is learning about the various spike-pits lying in wait for you, and the extra tooling required to mitigate its flaws comes with its own set of costs.
At the end of the day, though, you can write pleasant, readable and - yes - effective code in JS. There are worse languages to be stuck with, as long as you watch out for the spike-pits.
The fact that using JS you can write a browser based app, a mobile app, backend software, configuration files and flat data files (JSON) without switching gears is the flexibility.
I would also argue that if you really don't like JS, you are using the wrong tool for whatever job you are trying to do.
There are a few other smaller issues that are nuisances, like not being able to actually check if a value is a number, but I think coercions cause the most headaches for discoverability and debugging.
I respect Brendan Eich a great deal and I truly appreciate what he did for NetScape in 1995 by introducing JavaScript. What I don't appreciate is that we decided to extrapolate that madly-rushed, designed-and-implemented-in-less-than-a-week-of-all-nighters language not only into the default client side language for the web for the last 2 decades, but we have also allowed very badly informed people to start using it for server-side applications.
There has to be a way to bring order to this chaos. Any ideas?
The amount of "Bad Things" does make stumbling hazards, which is why I'm completely convinced that if you can, you should use a saner language, but there's no <script type="python"> (yet?). In those cases, we need to fence off the trash, put up warning signs on the exposed wiring, tape a post it note to "v instanceof Array" and try to write the sanest javascript we can.
My problem with people who say such things is that they almost always have been saying the same thing for many years, while the language itself did several 180° turns and backflips.
"Classes are stupid, we don't need them!" "Look, we have fake classes in ES6!" "Asynchronous code is awesome!" "Asynchronous code is horrible!" "Prototype mutation is awesome and powerful!" "Everything should be functional and immutable!"
If someone considers the current direction of JavaScript good, then they should have considered several previous directions absolutely idiotic. If, however, they are simply oblivious to the incessant flip-flopping of the "mainstream" JavaScript, their opinion about quality of any language is worth very little.
https://www.jwz.org/blog/2010/10/every-day-i-learn-something...
My question: IF we all (mostly) don't like JS, why don't we simply take Webkit or something and build-in our own (presumably) better language? Call it the "Hacker News Language for the Web" or something; the goal being to replace JS inside the browser. Naturally, we'd need a JS-to-HNL converter; but done properly, both front-end and back-end could be the same, and could be built on the 'natural' structures of The Web, 2020-style (and beyond!) (Maybe HNL is [a descendent of] ARC? Just riffing here...)
One more idea: If browsers would permit batches of signed and authenticated code to be made part of the browser semi-permanently (e.g. node.js, other JS/HNL libraries), then that would save the download time, speeding up sites. In fact, if the code were truly trusted, it could even be in assembly language(!!!! tie in, above) for some totally kick-ass performance. Assumes security issues properly solved.
Flexibility is good for frameworks, not for languages.
I read once a list of good and bad adjectives applied to paintings by Chinese painter Shi Tao. In the same vein here is my list for our topic.
Good computer languages are:
- Expressive, readable, memorisable, deterministic, stiff, simple, obvious, clear, concise, precise, sharp, smooth, pedestrian, regular, parsable.
Bad computer languages are:
- Obscure, arduous, terse, stark, viscous, flexible, lumpy, bumpy, redundant, verbose, restrictive, poetic, foolish, extravagant, awkward.
(This is not to be take too seriously, but just this: all built-in "flexibility" in languages leads to nightmares)
Obviously none of us truly believes that `convenience === quality`.
Serving pages rendered with node via webserver (nginx, apache) is not the most pleasant experience compared to e.g. python + wsgi
npm packages are not packages. It is simply a dependency definition + repository. Pull in package from npm and it is nowhere near usable until you figure out where it actually puts the files you care. You only know it's somewhere in `node_pacakges/`. Compare to e.g. gulp or python pip. You just pull in a package and it's usable.
Not usable for what? All you need to do is `npm install package` then in your project `const package = require('package')` and it's usable. Also, it's `node_modules`, and gulp itself is a task runner for... Node, so I don't understand your point there.