The Paradox of Partial Parametricity

Tom Van Cutsem tomvc.be at gmail.com
Mon May 27 06:40:51 PDT 2013


And to add why auto-unwrapping is the right thing to do when using
promises-for-control:

I think of promise/resolve as the async analog to function call/return.

In sequential programming, imagine a function f() that calls another
function g() and returns its result (i.e. the call to g() is a tail-call).
The callers of f() need not know or care that f used a nested call/return
to provide its result.

In async programming, imagine a function f() that asynchronously calls
another function g() and returns its promise-result. The async callers of
f(), who immediately receive a promise for f's result, need not know or
care that f used a nested async call/return to provide that result. Any
.then callback registered on f's promise wants to see the value returned by
g, not a promise.

When using promises-as-data, auto-unwrapping becomes the wrong thing to do.
Hence the clash in semantics. I hope that is a good summary of the debate.

Cheers,
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130527/fdbb6e37/attachment.html>


More information about the es-discuss mailing list