Futures (was: Request for JSON-LD API review)

Claus Reinke claus.reinke at talk21.com
Wed Apr 24 13:02:47 PDT 2013

> Now, instead of a ducktest for a `then` method the promise check would
> instead be specified as `instanceof Promise`. 

Picking a message at random for an interjection, there is something that 
seems to be missing in this discussion: 

*Promises are only one kind of  thenables (the asynchronous thenables)*. 

Ducktesting for 'then' will match things that aren't thenables (in the JS 
monadic sense), and identifying thenables will match things that aren't 

The type separation between thenables and Promises makes sense 
because there are library routines generically based on thenables that 
will work with Promises and with other thenables. At least, that is the
experience in other languages.

Also, much of the discussion seems not to be specific to Promises, asking
for a standard answer to the question of reliable dynamic typing in JS.


More information about the es-discuss mailing list