Finding a "safety syntax" for classes

Herby Vojčík herby at mailbox.sk
Tue Mar 20 12:55:10 PDT 2012


Russell Leggett wrote:
> On Tue, Mar 20, 2012 at 2:55 PM, David Herman <dherman at mozilla.com
> <mailto:dherman at mozilla.com>> wrote:
>
> Yes, I debated about this. In fact, I almost did go with new.
> Personally, I'm fine with either. I think what swung me in favor of
> "constructor" was:
>
> * other people seem to be happy with it, and that's what I'm shooting
> for here
> * CoffeeScript uses it. I don't really use CS, but it seemed short
> enough for them.
> * anyone making an additional .constructor is doing something bad, or
> maybe I just can't think of a good reason.

Well, I favour constructor because it blends well with the underlying 
mechanics... there _is_ a property named constructor in a prototype, 
pointing exactly to the constructor method of that prototype. So if I 
looks at the class {...} block as a blueprint for how the .prototype of 
the class will look like, it is the right name.

> Let's chalk this one down as a bike shedding issue that won't hold it back.
>
> - Russ
>
>
>     Dave


More information about the es-discuss mailing list