__proto__ and JSON

Felix Böhm esdiscuss at feedic.com
Wed May 30 07:12:03 PDT 2012

2012/5/30 Brendan Eich <brendan at mozilla.com>

> Felix Böhm wrote:
>> Okay, fair point. But JSON.parse should do what it's name says: Parse
>> JSON. Ignoring keys is not an option.
> JSON.parse must not treat __proto__ specially, per ES5. What's the problem
> you see?

As written before, V8 ignores keys named __proto__ in JSON.parse (I haven't
tested other engines yet). I was concerned that this behavior would become
the default.

>  Having __proto__ as a setter would make much more sense for me, too. No
>> magic involved, just some functionality I don't need to care about.
> Please see the thread on "Re: Subclassing built-in constructors", also the
> meeting notes followups from me. __proto__ has a hidden setter, it
> masquerades as a data property to avoid leaking a set-[[Prototype]]
> capability that would require extra checking and could (based on long and
> hard experience) lead to mischief.
> The de-facto and soon to be de-jure Object.prototype.__proto__ standard
> has no bearing on ES5's JSON.parse, which continues unchanged per the JSON
> RFC (I trust -- tell me if you see a bug).
> /be
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120530/2dde0cc3/attachment-0001.html>

More information about the es-discuss mailing list