Promise() vs. new Promise()

Andrea Giammarchi andrea.giammarchi at gmail.com
Wed Aug 20 06:45:00 PDT 2014


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);` which is
"yack" if you ask me


On Wed, Aug 20, 2014 at 2:08 PM, Alex Kocharin <alex at kocharin.ru> wrote:

>
> Normal classes throw an exception because they have a bug in them. :P
>
> Try "Error" vs "new Error" - no difference at all. `Promise` should do the
> same.
>
> The fact that it's a constructor is just an implementation detail after
> all. Thus, people shouldn't write `new` there.
>
>
> 20.08.2014, 16:52, "Axel Rauschmayer" <axel at rauschma.de>:
>
> Currently there seem to be two ways to create promises. Normal classes
> throw an exception if you call them as functions (without `new`). Should
> `Promise` do the same?
>
> Axel
>
> --
> Dr. Axel Rauschmayer
> axel at rauschma.de
> rauschma.de
> ,
>
> _______________________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140820/1dd1f9fc/attachment.html>


More information about the es-discuss mailing list