DEV Community

Now, I'm thinking is there anything that can't be done by JS?

Heithem Moumni on August 30, 2018

Collapse
 
ben profile image
Ben Halpern

Yeah. JS is not the right choice in many many many cases.

We happen to be in a place in history where JS is super convenient (or the only option) for a lot of user-facing stuff, but its value only goes so far.

Collapse
 
avalander profile image
Avalander

Nevertheless, the OP asked whether there is anything that can't be written in JS, not whether there is anything that shouldn't be written in JS :P

 
tunaxor profile image
Angel Daniel Munoz Gonzalez • Edited

yeah, like most OSes do, the rest of the os interaction (user facing stuff) is made with node/javascript

Core development is being done in layers. There could be some differences to adjust better to each target platform, but the general structure is:

  • barebones custom Linux kernel with an initramfs that boots to a Node.js REPL
  • initramfs Initram environment to mount the users partition & boot the system
  • usersfs multi-user environment with the same behaviour of traditional OSes

If you had said Kernels, yeah I would have bought it, but the res of the os is prominently javascript

 
tunaxor profile image
Angel Daniel Munoz Gonzalez

The statement was can't build an os, not a kernel while an os needs a kernel, not everything in the os has to be a kernel to work, just as in user space we use python, C++, C, java, and a ton of languages that underlying end up using 0's and 1's, node os builds it's os user space consuming side with javascript, just as that.
If you don't want to buy the idea it's fine, the project will still exist there and that OS wouldn't be usable without javascript so it fits the statement for me

Collapse
 
sudiukil profile image
Quentin Sonrel

I came to see that comment.

I was not disappointed.

Collapse
 
sudiukil profile image
Quentin Sonrel

The thing is, programming is programming, you can do almost anything with almost any language.

Writing a complex system-level app in JS is like building a website with C. Is it possible? Yes. Is it a good idea? That's another debate (spoiler: no).

Collapse
 
pkristiancz profile image
Patrik Kristian

making Arduino blink :P

Collapse
 
tunaxor profile image
Angel Daniel Munoz Gonzalez

think twice hahaha johnny-five.io
and here a small tutorial
makeuseof.com/tag/control-arduino-...

Collapse
 
pkristiancz profile image
Patrik Kristian

damn! 😭

Collapse
 
joshualjohnson profile image
Joshua Johnson

Create a stable library that stays cool for longer than 120 days. Seems like we in JS land keep moving to the next best thing so quickly.

 
qm3ster profile image
Mihail Malo

But what a great interpreter that one is!

 
qm3ster profile image
Mihail Malo
  1. Third one is native.
  2. C++ doesn't have native bigint.
Collapse
 
qm3ster profile image
Mihail Malo

In order of increasing performance and decreasing legacy compatibility:
github.com/MikeMcl/bignumber.js
github.com/justmoon/node-bignum
github.com/tc39/proposal-bigint

Collapse
 
alchermd profile image
John Alcher

Surely one can theoretically write a JS app that spits out memory-efficient, type-safe code in another language?

Collapse
 
avalander profile image
Avalander

I'm not sure we have a runtime to write embedded software in javascript, yet.

Collapse
 
tunaxor profile image
Angel Daniel Munoz Gonzalez

you can use javascript for windows 10 IoT devices
docs.microsoft.com/en-us/windows/i...
not sure how far does it go into embedded software but I think it fits at least a little

Collapse
 
tunaxor profile image
Angel Daniel Munoz Gonzalez

sorry about that github.com/NodeOS/NodeOS