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
Promises.
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.
Claus
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss