There have been multiple thread on this and I did not know were to comment, so 
I'll add few comments here.

I think that whole constructors as classes business in JS is confusing for 
everyone coming to JS, and they only understand it after understanding 
confusing constructor- prototype relationship.

It is true that people find 

var point = new Point(x, y)
point instanceof Point

intuitive but that's because it looks like Java. Also they are quite puzzled to 
find out that in some cases:

var point = Point(x, y)

works the same.

On the other hand people may find Point.new(x, y) as intuitive, as they will 
think of ruby instead of java. Also, I do not think there is a point to use 
`constructor` with all it's confusing prototype relationships for 
initialization in "prototypes as classes", just use initialize method to do 
that. 

Is it really too late to undo `constructor` as classes ? There are other 
proposals like rest and spread with a hope that `arguments` will die off some 
day. Why this would be different ?

Finally I believe that killing constructors will make js straight forward to 
understand and lighter in syntax.

And not everyone tries to emulate classical inheritance today:
http://javascript.crockford.com/prototypal.html


Regards
--
Irakli Gozalishvili
Web: http://www.jeditoolkit.com/
Address: 29 Rue Saint-Georges, 75009 Paris, France (http://goo.gl/maps/3CHu)


On Thursday, 2011-06-30 at 24:24 , Axel Rauschmayer wrote:

> > Last concrete disagreement we had was over new C() vs. C() in the current 
> > language being notably different from new C() vs. C.constructor() in the 
> > alternate-reality language with prototypes as classes.
> 
> 
> As in “don’t mix too well”. I agree with that. That will be a challenge for 
> class literals. But the abstraction argument might apply to both cases: If 
> people see a class C, they just want to instantiate it via new C(x,y). As 
> long as instanceof works accordingly afterwards, I’m not sure much has 
> changed *superficially*.
> 
> -- 
> Dr. Axel Rauschmayer
> 
> [email protected] (mailto:[email protected])
> twitter.com/rauschma (http://twitter.com/rauschma)
> 
> home: rauschma.de (http://rauschma.de)
> blog: 2ality.com (http://2ality.com)
> 
> 
> 
> _______________________________________________
> es-discuss mailing list
> [email protected] (mailto:[email protected])
> https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to