B.3.1 The __proto__ pseudo property

Andrea Giammarchi andrea.giammarchi at gmail.com
Mon May 20 17:58:59 PDT 2013


can I ask when is next TC39 meeting?

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?

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.
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> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130520/74630461/attachment.html>


More information about the es-discuss mailing list