http://wiki.ecmascript.org/doku.php?id=harmony:object_extension_literal_class_pattern
const className = superClass <| function(/*constructor parameters */) {
//constructor body
super.constructor(/*arguments to super constructor */);
this.{
//per instance property definitions
};
}.prototype.{
//instance properties defined on prototype
}.constructor.{
//class (ie, constructor) properties
};
The main problem is that obj.prototype.{...} does not evaluate to obj, then one
could chain additions to the function. With custom Function.prototype.*
methods, that can be easily achieved:
const className = superClass <| function(/*constructor parameters */) {
//constructor body
super.constructor(/*arguments to super constructor */);
this.{
//per instance property definitions
};
}.proto({
//instance properties defined on prototype
}).class({
//class (ie, constructor) properties
});
But what if one could write a function like an object literal?
const className = superClass <| function {
(/*constructor parameters*/): {
//constructor body
super(/*arguments to super constructor*/);
this.{
//per instance property definitions
};
},
prototype: {
}
//class (ie, constructor) properties
};
--
Dr. Axel Rauschmayer
[email protected]
home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss