On 5/21/2013 9:43 AM, Andrea Giammarchi wrote:
On Tue, May 21, 2013 at 12:56 AM, Brendan Eich <[email protected] <mailto:[email protected]>> wrote:

    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.

I mean that JSON, as part of the specs, needs to consider that "magic" property case, resulting into an `instanceof Object`, with an enumerable property that will show up in a `for/in` loop but it's not able to mutate the object.

```
var obj = JSON.parse('{"__proto__":[]}');
alert(obj instanceof Array); // false
alert(obj["__proto__"] instanceof Array); // true
obj["__proto__"] = obj["__proto__"];
// or
for (var key in obj) {
  obj[key] = obj[key];
  // could be a generic
  // clone operation
}
alert(obj instanceof Array); // false
alert(obj instanceof Object); // true
```

Above kind of object is "not perfectly described in current specs" and is different from any other where the `__proto__` is the inherited and not own property.

JSON is not a subset of JS [1] already. There's no reason why it has to follow a newly specified JS syntax rule.

[1] http://timelessrepo.com/json-isnt-a-javascript-subset
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to