5 ms·
The ES6 draft spec now includes the (maximally minimal) class spec that was hashed out at the July TC 39 meeting. You can read the spec here: http://wiki.ecmasc
by joubert 14y ago
The ES6 draft spec now includes the (maximally minimal) class spec that was hashed out at the July TC 39 meeting. You can read the spec here: http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts http://wiki.ecmascript.org/doku.php?id=harmony:specification... and see some examples here: http://wiki.ecmascript.org/doku.php?id=strawman:maximally_minimal_classes http://wiki.ecmascript.org/doku.php?id=strawman:maximally_mi...
There's a cool project, Harmonizr (https://github.com/jdiamond/harmonizr https://github.com/jdiamond/harmonizr) which transpiles ES6 to ES5, which you can leverage to start using classes, modules, arrow syntax, etc. now. Demo: http://jdiamond.github.com/harmonizr/demo/demo.html http://jdiamond.github.com/harmonizr/demo/demo.html
- hayksaakian 14y agothank the lord, i can't imagine something as ubiquitous as javascript still has no syntactically intuitive class system
- darkstalker 14y agoThe MooTools library implements declarative class syntax for regular javascript: http://mootools.net/docs/core/Class/Class http://mootools.net/docs/core/Class/Class
- elehack 14y agoWhy not? Classes are just one implementation/realization of OOP. They're the most common, to be sure, but they're by no means the only way to do objects, nor are they necessarily the best. “There is more to OOP, Horatio, than is dreamt of in your philosophy.”
- jarek-foksa 14y agoFrom my read of the proposal ES6 classes feel more like syntactic sugar for the flawed concept of new/constructor/obj.prototype, you still have to mess with obj.prototype to achieve some tasks (e.g. define non-enumerable property). I would stay away from it and just use plain objects with Object.create().