Deprecating Future's .then()

Tab Atkins Jr. jackalmage at gmail.com
Tue Jun 4 14:51:54 PDT 2013


On Wed, Jun 5, 2013 at 12:51 AM, Mark S. Miller <erights at google.com> wrote:
> I am making here only an argument that .then's result behavior should be
> flatMap-like rather than .map-like. As for which of these the .chain camp
> prefers for .chain's result behavior, I am neutral. But if they choose
> .map-like, they'd be able to avoid the ugly assimilation hack.

Given that .chain is just a proposed name for the monadic operation,
which could also be called .flatMap, obviously the return value's
behavior should be flatMap like.

I don't understand what the "ugly assimilation hack" is. Is that
looking for non-promise thenables?  There's no particular reason that
.chain *needs* to do assimilation, particularly if we add a
Promise.from() which does assimilation for us (converting the thenable
into a real Promise)

> I agree. This terminology will lead to confusion: "To do promise chaining,
> use .then. The .chain method doesn't support promise chaining."

I have no idea what this line is talking about.  Of course .chain
supports promise chaining.  *Promise chaining is the entire point of
the monad.*  It's lines like this that make me unsure if we're just
using very different definitions for the same words for some reason,
or if there's a real gap of understanding on either or both sides.

~TJ


More information about the es-discuss mailing list