The Paradox of Partial Parametricity

Sam Tobin-Hochstadt samth at ccs.neu.edu
Sat May 25 10:58:04 PDT 2013


On Sat, May 25, 2013 at 1:30 PM, Brendan Eich <brendan at mozilla.com> wrote:
> 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.

This is twice as many methods on promises themselves: `then` vs `then`
and `chain`. Many more people will consume the promise datatype than
produce it, which mean that this does double the methods that
consumers need to know about.

Sam


More information about the es-discuss mailing list