> Personally I'd ask whether there is a good reason to have "class" properties > on the constructor.
I’m not too fond of them, either. Many current use cases go away with modules. However, sometimes, you want to define class-specific constants such as Point.ZERO. > Also you could just re-order the assignment like so : > > const className = superClass <| function(/*constructor parameters */) { > //constructor body > super.constructor(/*arguments to super constructor */); > this.{ > //per instance property definitions > }; > }.{ > //class (ie, constructor) properties > }.prototype.{ > //instance properties defined on prototype > }; Won’t work: The value of className will be the prototype, not the function: x.prototype.{ ... } returns the value of x.prototype after the update. It might be possible to introduce an operator that returns the value of x after an update. For example (note the missing dot): x.prototype{ ... } Then the above becomes: const className = superClass <| function(/*constructor parameters */) { //constructor body super.constructor(/*arguments to super constructor */); this.{ //per instance property definitions }; }.{ //class (ie, constructor) properties }.prototype{ // no dot after "prototype" //instance properties defined on prototype }; -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss