{Spam?} Re: Promise() vs. new Promise()

Brendan Eich brendan at mozilla.org
Wed Aug 20 11:47:01 PDT 2014


Alex Kocharin wrote:
> Still doesn't make much sense... This pattern (this instanceof ...) breaks another pattern (BaseClass.call(this)). Why first one is deprecated, not the second one?

Fair point, and a topic at the last TC39 meeting was to *finally* add a 
way in JS to tell whether your constructor function was called via new 
or directly.

> I mean, I was able to subclass such a class with prototype injection without any issues, and it feels more natural in javascript after all.

You mean using `new`? Mileage varies, but I agree that client code that 
uses `new` well can add clarity about costs and reference uniqueness 
(lack of aliasing).

/be


More information about the es-discuss mailing list