Proposal: Additional Meta Properties for ES7

John Lenz concavelenz at gmail.com
Mon Mar 2 17:30:43 UTC 2015


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:

Promise.prototype.then = function(a, b) {
   ...
   if (function.called_from_void_result_context) {
     return undefined;
   }
   /* current behavior */
   ...
};


// example

somePromise.then(); // no chaining promise created by then

var x = somePromise.then(); // chaining promise created
x.then(); // no chaining promise created

I'm not really sure what impact this would have on the VMs but I found it
an interesting idea.









On Thu, Feb 26, 2015 at 2:47 PM, Allen Wirfs-Brock <allen at wirfs-brock.com>
wrote:

> Here is a new proposal for some additional meta properties that should be
> considered for ES7
> https://github.com/allenwb/ESideas/blob/master/ES7MetaProps.md
>
> I've added this to the agenda for next months TC39 meeting but pre-meeting
> discussion is always welcomed right here.
>
> Allen
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150302/18f96775/attachment.html>


More information about the es-discuss mailing list