> throw whenever a constructor is meant to be used as such without using `new`
On Wed, Aug 20, 2014 at 2:45 PM, Andrea Giammarchi < [email protected]> 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);` which is > "yack" if you ask me > > > On Wed, Aug 20, 2014 at 2:08 PM, Alex Kocharin <[email protected]> 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" <[email protected]>: >> >> 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 >> [email protected] >> rauschma.de >> , >> >> _______________________________________________ >> es-discuss mailing list >> [email protected] >> https://mail.mozilla.org/listinfo/es-discuss >> >> >> _______________________________________________ >> es-discuss mailing list >> [email protected] >> https://mail.mozilla.org/listinfo/es-discuss >> >> >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

