Where'd Promise#done go?

Claus Reinke claus.reinke at talk21.com
Fri Jun 21 08:46:39 PDT 2013


> <
> https://code.google.com/p/google-caja/source/browse/trunk/src/com/google/caja/ses/makeQ.js>
> supports promise pipelining in user land, using the makeRemote and makeFar
> extension points.

Hmm. If you are moving JS code (from the callbacks) to another site, 
some local references (including some that aren't even behind promises) 
become remote and vice versa. How do you manage this? And could you
please link to an application that shows how makeRemote would be used
in context?
 
> If we distinguish .then vs .there, you are describing .there above. With
> this distinction, do you agree that .then prevents this optimization?

No. I described how a specific variant of .then, passing promises to
callbacks, could account for more flexibility in resolution, time-wise, 
than a flattening .then could. Providing an interface that fits with the
protocol of a remote-executing .there is just one application of this 
additional flexibility (and my code left the remote-executing aspects 
implicit).

For language-level futures, the lack of explicit nesting gives the 
implementation the freedom to rearrange resolution as needed.
For JS promises, ruling out nesting robs programmers of the
freedom to rearrange resolution explicitly.

Claus
 


More information about the es-discuss mailing list