domenic at domenicdenicola.com (2013-07-12T16:18:52.435Z)
Yes, that was intentional. Even though the `__proto__:` looks related to
the `__proto__` property initially on `Object.prototype`, that's only
cosmetic. It is now simply part of the object literal syntax, in just the
same way that `<|` used to just be special syntax.
This does seem to leave a hole in the functionality compared to `<|`, which
is, how do you create a normal property named `__proto__`. The answer is
the computed property syntax: `{["__proto__"]: ...}`.
I don't remember what whether we decided that `{"__proto__": ...}` means the
same thing as `{["__proto__"]: ...}` or `{__proto__: ...}`. I think we decided
the second, which probably better follows the principle of least surprise.
OTOH, the first would have kept JavaScript closes to JSON.
Yes, that was intentional. Even though the "__proto__:" looks related to the "__proto__" property initially on Object.prototype, that's only cosmetic. It is now simply part of the object literal syntax, in just the same way that "<|" used to just be special syntax. This does seem to leave a hole in the functionality compared to "<|", which is, how do you create a normal property named "__proto__". The answer is the computed property syntax: {["__proto__"]: ...}. I don't remember what whether we decided that {"__proto__": ...} means the same thing as {["__proto__"]: ...} or {__proto__: ...}. I think we decided the second, which probably better follows the principle of least surprise. OTOH, the first would have kept JavaScript closes to JSON. On Thu, Jul 11, 2013 at 9:06 PM, Luke Hoban <lukeh at microsoft.com> wrote: > > From: es-discuss-bounces at mozilla.org [mailto: > es-discuss-bounces at mozilla.org] On Behalf Of Erik Arvidsson > > Yeah, these test all look incorrect to me. IE11 implements an older > draft where __proto__ was a magic property. > > That’s right. Our implementation predates the May spec updates that > changed the spec for __proto__. We will update the test contributions to > tests262 to align with the updated spec. > > One question from looking at implications of this change. Is it > intentional that there is no longer a way to remove (or customize) the > special handling of __proto__ in object literals? > > delete Object.prototype.__proto__ > var p = { y: 34 } > var o = { x: 42, __proto__: y } > o.y === 34 // was false, now true > > Luke > > _______________________________________________ > es-discuss mailing list > es-discuss at mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > -- Cheers, --MarkM -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130711/d795dd2f/attachment-0001.html>