Proposal: Additional Meta Properties for ES7

Mark Miller erights at gmail.com
Mon Mar 2 17:58:57 UTC 2015


On Mon, Mar 2, 2015 at 9:30 AM, John Lenz <concavelenz at gmail.com> 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:
>
> Promise.prototype.then = function(a, b) {
>    ...
>    if (function.called_from_void_result_context) {
>      return undefined;
>    }
>    /* current behavior */
>    ...
> };
>

More controversially, we might consider


    if (function.called_from_void_result_context) {
      /* proposed .done behavior */


I'm not sure what I think of this. It is kinda scary, but it might be the
right thing.




>
>
> // 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
>>
>>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>


-- 
Text by me above is hereby placed in the public domain

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


More information about the es-discuss mailing list