B.3.1 The __proto__ pseudo property

Brendan Eich brendan at mozilla.com
Tue May 21 00:56:15 PDT 2013


Andrea Giammarchi wrote:
> can I also suggest to analyze, if there's still any doubt left on a 
> method VS a property yet, this piece of code if not highlighted before?

I do not understand what you mean here.

>
> Behavior in Safari and FirefoxNightly (V8 still by its own here)
>
> ```
> var obj = JSON.parse('{"__proto__":[]}');
> console.log(obj instanceof Array); // false
> for(var key in obj) console.log(key); // logs: __proto__
> obj[key || "__proto__"] = {};
> console.log(obj instanceof Array); // false
> // immutable via string
>
> var obj = {"__proto__":[]};
> console.log(obj instanceof Array); // true
> for(var key in obj) alert(key); // never happens
> obj[key || "__proto__"] = {};
> console.log(obj instanceof Array); // false
> // changed via string
> ```
>
> Those look like two different kind of Object instance.

JSON is not JS.

I'm not sure what this has to do with anything discussed recently in 
this thread.

We are not going to go around the "don't standardize __proto__" barn 
again. Anyone trying to get web share with a new browser (which these 
days must include "the mobile web") needs to implement __proto__. That's 
why it is going into annex B at least.

/be

> Nothing would ever happen with an explicit method instead and less 
> troubles in specs for JSON too (together with for/in loops and 
> property behavior with null objects and not null objects)
>
> Thanks and Best Regards
>
>
>
> On Mon, May 20, 2013 at 2:55 PM, Brendan Eich <brendan at mozilla.com 
> <mailto:brendan at mozilla.com>> wrote:
>
>     Andrea Giammarchi wrote:
>
>         that's fine with what I am thinking/saying ... it's used as
>         reflection, to intercept, or to trap, and not used to "do the
>         action" of setting the prototype so `Object` is, and you
>         confirmed this, a better place for `setPrototypeOf`
>
>     No, Brandon wrote:
>
>     "[for every meta-level operation], there is a corresponding
>     function in Reflect that does the default behavior for that
>     [meta-level operation]".
>
>     Don't confuse proxy handler traps with Reflect.* methods. This is
>     why Tom asked whether we really need Object.setPrototypeOf, given
>     the identital (in behavior, could even be the same function
>     object) Reflect.setPrototypeOf.
>
>     This all needs to be discussed at this week's TC39 meeting. Allen,
>     could you please add it to the agenda.
>
>     /be
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss


More information about the es-discuss mailing list