Where'd Promise#done go?

Forbes Lindesay forbes at lindesay.co.uk
Thu Jun 20 15:25:04 PDT 2013


Returning to Mark Miller's comment:

> Any beginning JavaScript programmer learns the meaning of `a.foo(b,c)`, i.e., synchronous message send, long before they learn about callbacks.

I don't see any simple and obvious path from understanding the synchronous message send to understanding how promises work.  How does that explanation look?

It seems on the other hand I can see a natural progression from callbacks to `.done` and from `.done` to `.then` because if you write any code using `.done` it's infinitely obvious that you need `.then`.

I think it's interesting to also reflect on Tasks in C# which have been around for a while.  They don't have any methods for automatically tracking unhandled rejections even though the language supports handling object destruction.  All the methods that are built in to the Task object match up with `.done` rather than `.then`.  This becomes much less of a problem once the language has `await` or similar.


More information about the es-discuss mailing list