Proposal: Additional Meta Properties for ES7

Mark Miller erights at gmail.com
Mon Mar 2 19:19:00 UTC 2015


On Mon, Mar 2, 2015 at 10:45 AM, Allen Wirfs-Brock <allen at wirfs-brock.com>
wrote:

>
> On Mar 2, 2015, at 9:30 AM, John Lenz wrote:
>
> > I was recently discussion Promise optimizations (specifically, that in
> any "then" chain at least one Promise object is created that goes unused),
> this could be solved by some metadata that indicated whether the result of
> the function would be consumed:
> >    ...
> >    if (function.called_from_void_result_context) {
> > ...
> > I'm not really sure what impact this would have on the VMs but I found
> it an interesting idea.
>
> Essentially, this means that an additional implicit parameter
> ("calledForValue") needs to be added for every function call.  At the MOP
> level this would manifest as an extra argument to the [[Call]] internal
> method.  It could be defined to default to true and implementation could
> probably optimize for the default case.  But, at least conceptually it
> requires passing additional information across the call boundary.  that
> might be a bit much if this is only about optimizing promises.


Allen, sadly, I expect you are correct about this.

Infix ! could, nevertheless, statically expand to .send or .sendOnly
depending on static syntactic context, without any further runtime
implication, as in E.

But .then, being a normal method call rather than distinct "when" syntax,
would not be able to gain a similar benefit.


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


More information about the es-discuss mailing list