News for hackers. Stuff that matters.
Re:A small but complete JavaScript engine by hansjorg on Saturday October 24, 2020 @07:10PM (#24882630)
I realize you're joking, but a company called Samsung actually did something similar already: https://nodejs.org/
Re:A small but complete JavaScript engine by rzr on Saturday October 24, 2020 @09:57PM (#24883309)
dont you mean https://iotjs.net ?
Re:A small but complete JavaScript engine by kdtop on Saturday October 24, 2020 @07:19PM (#24882675)
Serious question, why is this a joke? Couldn't javascript be just another language to replace bash?
Re:A small but complete JavaScript engine by vbezhenar on Saturday October 24, 2020 @07:59PM (#24882847)
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.
Re:A small but complete JavaScript engine by saagarjha on Saturday October 24, 2020 @07:39PM (#24882770)
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.
Re:A small but complete JavaScript engine by PrinceKropotkin on Saturday October 24, 2020 @10:07PM (#24883337)
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.
Re:A small but complete JavaScript engine by barumi on Sunday October 25, 2020 @03:20AM (#24884431)
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.

Re:A small but complete JavaScript engine by saagarjha on Sunday October 25, 2020 @01:26AM (#24884072)
Python and Perl don't run natively in the three major browser engines.
Re:A small but complete JavaScript engine by mhh__ on Sunday October 25, 2020 @12:20AM (#24883808)
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)
Re:A small but complete JavaScript engine by barumi on Sunday October 25, 2020 @03:14AM (#24884415)
> 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.