Proposal: Additional Meta Properties for ES7

Allen Wirfs-Brock allen at
Mon Mar 2 18:45:19 UTC 2015

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.


More information about the es-discuss mailing list