|
|
|
|
|
by thedufer
4681 days ago
|
|
The whole event loop idea, which is core to javascript, allows for the single-threaded non-blocking I/O in a way that no other popular language does. Because of this, javascript has features that make this type of programming easy - first-class functions, anonymous functions, etc. So, yes. Non-blocking I/O is a standard library feature, but it works because of language features. |
|
Event loops are not a property of JavaScript of any other programming language: Every single GUI Win32 application ever written in C directly calling the WinAPI contains an explicit event loop.
> "(...) in a way that no other popular language does. Because of this, javascript has features that make this type of programming easy - first-class functions, anonymous functions, etc."
JavaScript is hardly the only language, or even the only popular language, to ever have first-class procedures or anonymous procedures. You know what (at some point in time) widely taught language has a procedure data type[1]? Pascal. So why not Node.pas instead?
> "So, yes. Non-blocking I/O is a standard library feature, but it works because of language features."
That countless other languages have. Most of them a lot better designer than JavaScript.
===
[1] Edit: I originally suggested Pascal has anonymous procedures, which it does not.