Summary:
Update "Object Literal Extensions" [1] to integrate with constructor
parameters for concise instance initialization.
Details:
function f (a, !~this.b, this.c:= 1) {
g(a);
}
// results in f's [[Construct]] ( but not [[Call]] ) behaving like:
function f (a, b, c = 1) {
Object.defineProperty(this, "b", {configurable: false, enumerable:
false, writable; true, value: b};
Object.defineProperty(this, "c", {configurable: true, enumerable:
true, writable; false, value: c};
g(a);
}
Grammar changes to [1] :
FormalParameter :
FormalParameterPrefixOpt Identifier FormalParameterInitialiserOpt
// possibly integrate with destructuring and/or rest parameters as well
FormalParameterPrefix :
PropertyPrefixOpt thisOpt . // "this" is optional
FormalParameterInitialiser :
:Opt Initialiser
[1]
http://wiki.ecmascript.org/doku.php?id=strawman:basic_object_literal_extensions
Cheers,
Sean Eagan
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss