3 ms·
Are you seriously arguing against event loops as a category? Blocking in non-blocking code is going to be an issue whether the language is C or JavaScript (duh)
by james-mcelwain 7y ago
Are you seriously arguing against event loops as a category? Blocking in non-blocking code is going to be an issue whether the language is C or JavaScript (duh).
- phoe-krk 7y agoFor these kinds of programming, yes, I argue against it. A single stalling function in Node deadlocks the whole system; a single stalling thread in the C++ model still permits other threads to run. This is a risk that is completely avoidable by not using languages which require event loops at their core.
- megous 7y agoJavaScript doesn't require event loop design. You can do a PHP like backend design with JS, where each request is handled by a fresh process, and all JS functions block. There's nothing in the language that prevents this. Some features would become unusable, like Promises and async/await, but those would be worthless in such a design anyway.
- phoe-krk 7y agoNobody does it. Nobody implemented it yet. Nobody made it production ready. That is what a few minutes of googling gave me. As much as I'd like to see it, your JS without an event loop is a purely theoretical construct so far.
- megous 7y agoI did blocking design using Duktape for my runtime Linux distro reinstallation tool and some other projects. It works fine and it's easier than implementing async aware bindings. I wouldn't implement it for the HTTP server/backend use case, because I find the blocking/share nothing architecture of PHP limiting. The point is the language doesn't prevent this kind of architecture.