3 ms·
Despite the downvotes, you are absolutely correct. My feeling, after working on a moderately complex server application in Node is that it was designed for only
by dboreham 11y ago
Despite the downvotes, you are absolutely correct. My feeling, after working on a moderately complex server application in Node is that it was designed for only very simple applications that can be done with one level of callback. I find the "it works this way because its better" cult quite irritating. It works that way because the #*(^#$&^ JS interpreter isn't multithreaded.
- to3m 11y agoIt wouldn't even need to be multithreaded, I don't thnik. You could have some green threads-type system, using asynchronous I/O, a single-threaded server, and something along the lines of Lua's yieldk. Have a new script spring into life for each connection, suspend it when an I/O operation starts, and resume it when the results are ready (or when something goes wrong). I think this will be what Erlang does. (I'm sure there are potential problems with this, but hopefully it would be overall no worse than the current situation, while being easier to work with.)
- qaq 11y agoon the browser side modern browsers support webworkers on the node side https://www.npmjs.com/package/webworker-threads https://www.npmjs.com/package/webworker-threads