If there were a more usable library variant of Object.create instead, it seems
the new syntax here would not be as necessary.
Instead of:
var o = myProto <| {
a: 0,
b: function () {}
}
You could do:
var o = Object.make(myProto, {
a: 0,
b: function () {}
})
A few more characters, but still addresses the major issue preventing wider
Object.create usage (the use of property descriptors). A library solution also
keeps the benefit of not needing new syntax, and being available to
text/javascript. As noted in the strawman, similar functions on Array and
Function could support the other scenarios described in the proposal.
It seems the syntax is perhaps aiming to avoid needing to allocate an
intermediate object - but I imagine engines could potentially do that for
Object.make and friends as well if it was important for performance?
Luke
From: [email protected] [mailto:[email protected]] On
Behalf Of Allen Wirfs-Brock
Sent: Tuesday, May 17, 2011 7:50 PM
To: [email protected]
Subject: prototype for operator proposal for review
We had so much fun with feedback on my Unicode proposal I just have open
another one up for list feed back:
An updated version of the "prototype for" (formerly proto) operator proposal is
at http://wiki.ecmascript.org/doku.php?id=strawman:proto_operator
Allen
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss