3 ms·
Serious question, why is this a joke? Couldn't javascript be just another language to replace bash?
by kdtop 6y ago
Serious question, why is this a joke? Couldn't javascript be just another language to replace bash?
- saagarjha 6y agoPeople typically write small, short scripts in bash, not web applications. The same goes for JavaScript, but in reverse. They were designed for different things.
- PrinceKropotkin 6y agoThere's nothing about javascript that makes it particularly suited for "web applications". This doesn't seem any more ridiculous than, say, using python or perl.
- saagarjha 6y agoPython and Perl don't run natively in the three major browser engines.
- PrinceKropotkin 6y agoSure, but that doesn't speak to the language.
- barumi 6y agoBeing event-driven and simple and hot reloadable and forgiving does make it well suited for the task at hand. You should really think about why javascript is the de facto standard for web scripting. Other alternatives have appeared but even the likes of Google, which control the entire web stack and can pretty much dictate what the world uses, decided against it.
- PrinceKropotkin 6y agoIt's the de-facto standard for web scripting because browsers forgot to build anything other than the bare minimum to ship new features incrementally. There's nothing about the languge itself that is preternaturally suited to the task at hand; in fact I'd argue it's the largest single impediment to scripting the browser outside of political sources (e.g. browser vendors).
- vbezhenar 6y agobash is a domain specific language. It has many features to easily launch programs, setup stream redirects to files or to other programs. JavaScript is a general purpose programming language. It might be a better choice for general purpose programs, but when you need to glue some programs together, nothing comes close to shell scripting languages.
- mhh__ 6y agoI guess, but I think JS is to far away from C to be worth it. This is saying a lot coming from me, but I would rather write python - at least longs would be the right length (if you catch my drift)
- barumi 6y ago> Couldn't javascript be just another language to replace bash? Technically the answer should be "yes", but given the event-driven nature of javascript and a shell script's very specialized design goals (launch processes, control the runtime environment, provide a workable REPL, etc) then it wouldn't be an improvement over any of the current shell scripting languages. As a general-purpose scripting language... That's an entirely different matter, and the answer is definitely yes. In fact, node.js and deno already do just that.