Promise() vs. new Promise()

Andrea Giammarchi andrea.giammarchi at gmail.com
Wed Aug 20 07:26:46 PDT 2014


Yep, I was rather talking about a more generic approach with constructors,
I've picked the wrong one for the example.

Thanks for clarification


On Wed, Aug 20, 2014 at 2:56 PM, Boris Zbarsky <bzbarsky at mit.edu> wrote:

> On 8/20/14, 9:45 AM, Andrea Giammarchi wrote:
>
>> Alex I think the new direction is to throw whenever a constructor is
>> meant to be used as such. If you don't want to use new you can `var p =
>> Object.create(Promise.prototype); Promise.call(p, executor);`
>>
>
> This won't work correctly, since 'p' won't have the right internal slots.
> So http://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise step
> 3 will throw.
>
> -Boris
>
> _______________________________________________
> 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/20140820/2858e15a/attachment.html>


More information about the es-discuss mailing list