The Paradox of Partial Parametricity

Brendan Eich brendan at mozilla.com
Sat May 25 10:30:33 PDT 2013


Sam Tobin-Hochstadt wrote:
> In the meeting, there were (a) people advocating for styles of
> programming along the lines that you (Tab) have put forward, like me,
> (b) people advocating for Q-style programming, like Mark, Yehuda, and
> Tom, and (c) genuine concern about the complexity budget of the
> promise API, expressed most by Luke Hoban, but felt by all of us. Were
> it not for this last concern, I think AP2 would have seemed more
> attractive.  But since the set of methods available on Promises
> themselves is the most visible part of the API, and AP2 doubles its
> size, that told heavily against AP2.

AP2 from Mark's slides:

AP2 (Based on Tab’s latest)
• Q.fulfill // lifting
• Q() // autolifting, resolve
• p.then // deep flattening
• p.flatMap // “chain”

AP3, next slide:

AP3
• Q.fulfill // lifting
• Q() // autolifting, resolve
• p.then // deep flattening of returned value

There's no doubling, just 4 methods instead of 3. If we can't do what 
you preferred, lose the recursive unwrapping, then either users hack 
{value: x} workarounds and sometimes end up with bugs where such 
wrappers were not manually unwrapped -- or we add chain. I'm with Tab on 
this.

/be


More information about the es-discuss mailing list