Is class syntax really necessary ?

Irakli Gozalishvili rfobic at gmail.com
Mon May 23 03:17:45 PDT 2011


Hi,

I think there lot's of proposals for ES.next that require syntax extensions, which is probably worth if new functionality added or shortens most commonly used constructs like functions (were no other option is available). In case of this proposal: http://wiki.ecmascript.org/doku.php?id=strawman:classes_with_trait_composition#open_issues even though
I like it I'm not sure adding new syntax is worth it.

I'm not suggesting that sugar for class composition is not necessary, example from three.js used by proposal highlights necessity pretty very well, I'm just thinking of doing that without introducing new syntax, here is one option: https://gist.github.com/986487

This way syntax noise may be reduced in addition this can be shimmed into current JS by implementing `Function.prototype.extend`.

Also every single frameworks today does something similar in one form or another, IMO all is necessary is to have a standard that will let bikeshedding go away. I think there is also a good precedent of this with `Function.prototype.bind`.

Here are some related links:

http://documentcloud.github.com/backbone/
http://base2.googlecode.com/svn/version/1.0.2/doc/base2.html#/doc/!base2.Base
http://prototypejs.org/learn/class-inheritance
http://startdojo.com/2011/03/02/dojo-classes-inherited-and-constructors/
http://mootools.net/docs/core/Class/Class
http://ejohn.org/blog/simple-javascript-inheritance/


Kind regards
--
Irakli Gozalishvili
Web: http://www.jeditoolkit.com/
Address: 29 Rue Saint-Georges, 75009 Paris, France

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110523/09052c20/attachment.html>


More information about the es-discuss mailing list