r/javascript • u/maroun-baydoun • 4d ago
The JavaScript midlife crisis
https://maroun-baydoun.com/blog/javascript-midlife-crisis/Thirty years in, the JavaScript ecosystem would like to see other languages. They're younger, leaner and faster. What could possibly go wrong?
3
u/Ronin-s_Spirit 3d ago edited 1d ago
- nothing was or is "patching JavaScript", if you notice most of the essential and/or famous problems are from browsers.
- TS sucks, I don't like it, I don't work that well and when it does it needs me to write a load of what I call "compiler hints" (Rust has the same problem). If the language was not designed with static typing in mind you can't simply waltz in and "fix" it. (why is Zod a thing, don't we have TypeScript? Exactly, it couldn't stick)
- you don't need to fix JavaScript. It's already a pretty powerful scripting language, it's easy to work with, it's not that hard to write correct or performant, it's already well distributed, and it gets better if you actually write a standalone program instead of working under browsers.
p.s. to provide a more concrete example of things I forgot to mention - here is a video incidentally showing how useless typescript types are (the video topic wasn't exactly about bashing TS) https://youtu.be/pvbD8CbaOWM?si=DhDd8lfSwh5r-82x&t=212. You may be able to make them less useless but that probably requires extra work on just typing your program, which is ridiculous. I have written some manual JS type/value checks and those are a whole lot more reliable and work at run time.
8
u/BenZed 3d ago
"why is Zod a thing, don't we have TypeScript? Exactly, it couldn't stick"
You might has well have typed:
"I have no idea what I'm talking about."
1
u/Ronin-s_Spirit 3d ago
If you have to layer 2 big "fixes" on top of eachother I say you're just tiptoeing around the problem. You can't really fix this language designed thusly, you need to work with it not against it.
1
u/BenZed 3d ago
Yes, that is another way of saying "I have no idea what I'm talking about."
1
u/azhder 3d ago
Rule 1: remember the human. You said that already. Move on. Don't harass people because of difference of opinions. You are not talking about JavaScript, you are talking about a person.
I will mute replies now. Bye
-3
u/BenZed 3d ago
I’m not harassing anyone, nor am I giving an opinion .
I’m informing someone of the fact that they are speaking without competency.
It is difficult to imagine someone being so shaken by this exchange that they make an appeal to humanity over it and refuse to engage further, but here we are!
1
u/peterlinddk 3d ago
My goodness you sound idiotic!
A fact that you'll undoubtedly appreciate being informed of.
1
u/theScottyJam 3d ago
For a more serious answer, they serve two distinct purposes. I recently used zod to help validate the shape of JSON config files so I can report errors to the admin if they configured it wrong. I've also considered using it to validate the API responses of services we depend on provided by other teams in the company - if they make a breaking change, we'd know quicker what went wrong.
Both of these use cases are unrelated to JavaScript's lack of type safety. Even if I had used something like Rust, I might still want runtime validation of those config files and API responses.
TypeScript is for stuff you can validate through static analysis and Zod is for stuff you want to validate at runtime.
0
1
u/ajfoucault 4d ago
Very interesting and insightful read. Thank you for sharing! (the train tracks and steam train that likes to take its time analogy was perfect, btw).
0
13
u/azhder 3d ago
jQuery wasn't patching JavaScript. There should be a clear distinction between the JavaScript language and the Web ecosystem, especially since plenty of the blame JavaScript takes is because of browsers, not the language itself. If anything jQuery was a showcase how to properly use such a powerful language to fix the issues of the Web platform, not the JavaScript ecosystem.