Minimalist (why) classes ?

Irakli Gozalishvili rfobic at gmail.com
Fri Nov 11 15:47:40 PST 2011


Hi, 

I have posted this to the long thread of "Minimalist Classes", but since I have not got any response, I assume it got lost into a long discussion. So I thought I'll give it another try on fresh thread.

I do really liked direction that Jeremy tried to push classes to, but still I don't understand why do we need to introduce new syntax to the language. From what I can tell, lack of classes or special syntax for creating ones, is not a problem. Problem is amount of ceremony one needs to perform inherit or subclass if you like.

Also, I think we don't need new `class` expression to solve actual problems we have, simple function will do the job perfectly here, also it will add zero learning curve! I forked Jeremy's proposal and modified it to ilustrate how existing subclassing problems can be solved without introducing new constructs to the language or adding more verbosity. Please also note that there is nothing new here, lot's of frameworks do this already (hide prototype machinery), but each does it with it's own flavored API which is IMO another problem that standardization should solve. The classes problem is very similar to `Function.prototype.bind` that ES5 solved greatly, why not do the same for classes ? 

https://gist.github.com/1355701

In addition I tried to address few other concerns I had with a proposal:

-  `constructor` property as initializer is poor choice raising many questions (what will be prototype of constructor property if it's used in more then one class, if it's frozen etc).
- Some people in the community would love to have frozen classes others value flexibility, simple functions make it easy to build first out of second without becoming a second class citizen.


Please note, that I intentionally omitted `super` as it's separate problem that is / must be discussed in the separate thread / proposal.
Regards
--
Irakli Gozalishvili
Web: http://www.jeditoolkit.com/
Address: 29 Rue Saint-Georges, 75009 Paris, France (http://goo.gl/maps/3CHu)



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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20111111/7ee5a250/attachment.html>


More information about the es-discuss mailing list