Hacker News new | ask | show | jobs
by kdtop 2067 days ago
Serious question, why is this a joke? Couldn't javascript be just another language to replace bash?
4 comments

bash 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.
People typically write small, short scripts in bash, not web applications. The same goes for JavaScript, but in reverse. They were designed for different things.
There'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.
Being 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.

Python and Perl don't run natively in the three major browser engines.
I 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)
> 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.