On Thu, Oct 13, 2011 at 3:27 PM, Brendan Eich <[email protected]> wrote:
> On Oct 13, 2011, at 6:00 PM, John J Barton wrote: > > Simply stated, the triangle operator lets you set the prototype of an >> object if and only if that object has not yet been observably instantiated. >> It's a small tradeoff, but it gives us many of the benefits of mutable >> protos without the known hazards. >> > > Of course I disagree, but at least I understand thanks, > > > Can you make the case for changing an "old-born" object's [[Prototype]]? > > I ask because I perpetrated this long ago in implementing writable > __proto__ in SpiderMonkey, including the cycle detection required to prevent > iloops. And then other browsers except (IIRC) IE reverse-engineered. So most > implementors have sunk the cost. That doesn't mean it is good sunk cost, or > that there are not ongoing taxes from writable __proto__. > > But we may as well hear your use-case (I know of others, e.g. John-David > Dalton's http://fusejs.com/ and Thomas Fuch's http://zeptojs.com/, but > they either want only to preset __proto__ on newborns, or [we think] have > better solutions in ES6 [e.g. proxies]). > I don't have an opinion on mutating __proto__; I've not see good or bad come of it. I was disagreeing with the <| (protoLinkSet?) operator's restriction on LHS to object literals. (I'm trying a different name) Dean's characterization I should have objected to, rather than disagreeing with it. Given: var o2 = p <| {a: 'b'}; you can choose to imagine that the RHS object gets [[ProtoLink]] set to |p| then becomes |o2|, but you can equally imagine that |o2| becomes an object by initializing o2.[[ProtoLink]] = p and copying the properties from the literal declaration. The latter description has the same result, no JS developer can tell the difference. The first imagines mutation of an non-existent object; the second imagines copying during initialization with no mutation. Suppose for a moment we allowed objects on the RHS: var o3 = p <| o2; Would we imagine that o2 was mutated in any way? I don't think so. Maybe there are binary ops that mutate operands, but they don't come to mind. So the entire business about mutation of [[ProtoLink]] is not related to my interest in allowing object expressions on the RHS of protoLinkSet operator. I hope this is clearer, jjb
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

