Upcoming JavaScript improvements show promise


Domenic Denicola wrote earlier this year about how the upcoming introduction of "promises" ...well, promises to make writing non-trivial code in JavaScript, and nodejs, actually possible.

Right now, code in nodejs with its emphasis on non-blocking callbacks, is just about impossible to write for anything involving, let's say, databases. For decades we have been writing code like "get a value from the database, check it, look one of the fields up in another database, then..." and so on. We depend on the operating system, or the language constructs, to let other processes operate while the background I/O and computation happen. NodeJS forces us to confront all that nastiness ourselves, and "yield" operation with a callback happening upon completion. This is the way Macintosh 1.0 programs had to be written, and it is as much a nightmare now as it was thirty years ago.

Promises, though, hide the asynchronous nastiness and let values and errors propagate in a sane way.

Once JavaScript gets something like this in core, I might try writing something useful in NodeJS again.