Is class syntax really necessary ?

Irakli Gozalishvili rfobic at gmail.com
Sun Jun 12 02:22:23 PDT 2011


Hi,

Is there anything else (other than starting this thread) I can do to make committee consider `Function.prototype.extend` as an alternative to a proposed class sugar ? 

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


On Tuesday, 2011-05-24 at 24:48 , Brendan Eich wrote:

> On May 23, 2011, at 11:25 AM, Bob Nystrom wrote:
> 
> > One thing I'd like the proposal to support, which it doesn't currently, is initializers on instance property declarations. Then you could do: 
> > 
> > > class C { 
> > >  public _list = [];
> > > 
> > > 
> > > }
> > > 
> > > 
> > > 
> > 
> > 
> > With that, you'll correctly get a new _list on each instance of C when it's created. 
> But (we've argued, I forget where so repeating it here), this looks like [] is evaluated once when the class declaration is evaluated. That is not what you intend.
> 
> Then at some point (in the last thread on this) I remembered parameter default values, but they cover only missing parameters to the constructor. This _list member could be private. But it has to be initialized in a body that executes once per instantiation, which is not the class body -- it's the constructor body.
> 
> /be
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org (mailto: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/20110612/00e9ca58/attachment.html>


More information about the es-discuss mailing list