Re: Readdition of __proto__

2013-10-16 Thread Andrea Giammarchi
yeah, if you use an alias L the footgun image comes upside down too ``` L.__proto__ = null; // later on, in ES6 L.__proto__ = () pew, pew; ``` On Tue, Oct 15, 2013 at 11:01 PM, Brendan Eich bren...@mozilla.com wrote: Allen Wirfs-Brock wrote: On Oct 15, 2013, at 3:19 PM, Dean

Re: Readdition of __proto__

2013-10-15 Thread Dean Landolt
On Mon, Oct 14, 2013 at 8:32 PM, Allen Wirfs-Brock al...@wirfs-brock.comwrote: On Oct 14, 2013, at 4:21 PM, Andrea Giammarchi wrote: my last memories on the topic are these: ```javascript var obj = JSON.parse('{__proto__:[]}'); obj instanceof Array; // false obj.__proto__

Re: Readdition of __proto__

2013-10-15 Thread Benjamin (Inglor) Gruenbaum
Not resolving this like o3 (or o6 really) sounds very strange. I think: let attr = __proto__; let o7 = new Object; o7[attr] = p; // o7 inherits from p Is the correct behavior here (why would it not invoke the setter?) On Wed, Oct 16, 2013 at 12:04 AM, Dean Landolt d...@deanlandolt.com wrote:

Re: Readdition of __proto__

2013-10-15 Thread Allen Wirfs-Brock
On Oct 15, 2013, at 2:10 PM, Benjamin (Inglor) Gruenbaum wrote: Not resolving this like o3 (or o6 really) sounds very strange. I think: let attr = __proto__; let o7 = new Object; o7[attr] = p; // o7 inherits from p Is the correct behavior here (why would it not invoke the setter?)

Re: Readdition of __proto__

2013-10-15 Thread Brendan Eich
Benjamin (Inglor) Gruenbaum wrote: Not resolving this like o3 (or o6 really) sounds very strange. I think: let attr = __proto__; let o7 = new Object; o7[attr] = p; // o7 inherits from p Is the correct behavior here (why would it not invoke the setter?) Allen confirmed, but just to be clear,

Re: Readdition of __proto__

2013-10-15 Thread Dean Landolt
On Tue, Oct 15, 2013 at 5:50 PM, Brendan Eich bren...@mozilla.com wrote: Benjamin (Inglor) Gruenbaum wrote: Not resolving this like o3 (or o6 really) sounds very strange. I think: let attr = __proto__; let o7 = new Object; o7[attr] = p; // o7 inherits from p Is the correct behavior here

Re: Readdition of __proto__

2013-10-15 Thread Allen Wirfs-Brock
On Oct 15, 2013, at 3:19 PM, Dean Landolt wrote: So just to be clear, the only way to add a __proto__ property to an existing object is with Object.defineProperty? Object.mixin(obj, {[__proto__]:42}); Allen ___ es-discuss mailing list

Re: Readdition of __proto__

2013-10-15 Thread Andrea Giammarchi
not if you parsed that object via `JSON.parse('{__proto__:[]}')` in this case is the equivalent of that operation through `Object.defineProperty({}, '__proto__', {enumerable: true, writable: true, configurable: true})` so that `obj.__proto__` will result into property assignment and no setter

Re: Readdition of __proto__

2013-10-15 Thread Andrea Giammarchi
oh, that's cute :D too bad I cannot shim/polyfill that in my `Object.mixin` module. I would simply *red-flag* it and discourage the usage of `__proto__` everywhere is possible (uhm wait ... I've already done that in the past, never mind ... ) Happy `__dunder__` Everybody, Cheers On Tue,

Re: Readdition of __proto__

2013-10-14 Thread Brendan Eich
To search es-discuss, I use site:mail.mozilla.org es-discuss as first two terms in a Google search. Sometimes I just use es-discuss. If you add __proto__ you'll find lots to read. Add meeting notes and you'll find recorded TC39 decisions. I usually find links and include them here to avoid

Re: Readdition of __proto__

2013-10-14 Thread Benjamin (Inglor) Gruenbaum
Thanks. Found a bunch of interesting things. Hopefully I'll find some use case where it doesn't completely break the beautiful OOP behavioral typing gives us when we play nice with it (Yep, that dog of yours, he's no longer an animal) :) On Mon, Oct 14, 2013 at 11:10 PM, Brendan Eich

Re: Readdition of __proto__

2013-10-14 Thread Andrea Giammarchi
Yes, it's hard to search in this mailing list but luckily not everyone in here will tell you not to be that guy that clearly didn't read anything and is just annoying ^_^ Since I've personally pushed to drop `__proto__` I might be the right person to give you pros and cons. Feel free to ask me

Re: Readdition of __proto__

2013-10-14 Thread Andrea Giammarchi
On Mon, Oct 14, 2013 at 1:15 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: Yes, it's hard to search in this mailing list but luckily not everyone in here will tell you not to be that guy that clearly didn't read anything and is just annoying ^_^ Brendan, since you participated,

Re: Readdition of __proto__

2013-10-14 Thread Brendan Eich
Andrea Giammarchi wrote: __Current Status__ (Thanks for the dunders! :-P) Instead of formalizing its form, ES6 accepted `Object.setPrototypeOf` as described in specs and decided to silently move beside, but still have in specs, the dunder `__proto__` form, fixing at least a couple of

Re: Readdition of __proto__

2013-10-14 Thread Benjamin (Inglor) Gruenbaum
__Thanks__ ! This is really above and beyond what I could have asked for. I really wish there was an easy way to search the list like tags. I've been reading for a while but when I want to bring up, learn more about or discuss things - not being able to search really sucks. It makes me want to

Re: Readdition of __proto__

2013-10-14 Thread Brendan Eich
Andrea Giammarchi mailto:andrea.giammar...@gmail.com October 14, 2013 1:32 PM I meant that IIRC `obj[__proto__]` should not invoke that Annex B specified getter (@Benjamin, Annex B is where you'll find everything related indeed) but `obj.__proto__` will ... unless once again I've missed some

Re: Readdition of __proto__

2013-10-14 Thread Andrea Giammarchi
You are breaking an opened door with me and I've indeed pushed to **not** have `__dunder__` specd but, for how much remote anger I still have against some decision some famous library and its main author made few months ago ... * web developers and specially library authors are usually more

Re: Readdition of __proto__

2013-10-14 Thread Andrea Giammarchi
Then I might have confused what decided with `JSON` serialization where `__proto__` will be a property and not a setter, neither a getter once deserialized. Is this correct? Yeah, I remember that different accessors looked weird to me too ... thanks for clarification. Best Regards On Mon, Oct

RE: Readdition of __proto__

2013-10-14 Thread Domenic Denicola
From: es-discuss [es-discuss-boun...@mozilla.org] on behalf of Brendan Eich [bren...@mozilla.com] Our duty as a standards body includes specifying de-facto standards which browsers must implement to interop. __proto__ is one such. It's worth highlighting this aspect of the situation. This

Re: Readdition of __proto__

2013-10-14 Thread Andrea Giammarchi
`JSON` serialization = `JSON` parse On Mon, Oct 14, 2013 at 1:53 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: Then I might have confused what decided with `JSON` serialization where `__proto__` will be a property and not a setter, neither a getter once deserialized. Is this

Re: Readdition of __proto__

2013-10-14 Thread Mark S. Miller
From https://docs.google.com/a/google.com/file/d/0BxVCLS4f8Sg5NWZmM2NjZWEtYmExMS00Y2EzLWE3ZTMtNzFmYjYwYzBiOTIw/edit?hl=en_US, apparently in 1988: The Committee’s overall goal was to develop a clear, consistent, and unambiguous Standard for the C programming language which codifies the common,

Re: Readdition of __proto__

2013-10-14 Thread Rick Waldron
On Mon, Oct 14, 2013 at 4:47 PM, Brendan Eich bren...@mozilla.com wrote: Benjamin (Inglor) Gruenbaum mailto:ing...@gmail.com October 14, 2013 1:33 PM __Thanks__ ! This is really above and beyond what I could have asked for. Beware that what Andreas wrote about __proto__ in ES6 was not

Re: Readdition of __proto__

2013-10-14 Thread Brendan Eich
Rick Waldron wrote: Do you mean more then inclusion in Annex B? http://people.mozilla.org/~jorendorff/es6-draft.html#sec-other-additional-features http://people.mozilla.org/%7Ejorendorff/es6-draft.html#sec-other-additional-features The committee and community made the right move to go with

Re: Readdition of __proto__

2013-10-14 Thread Brendan Eich
I think you may have mixed up a few things: 1. JSON does not recognize '__proto__' per its unchanging spec, and so parsing that identifier makes an own data property. 2. var obj = {__proto__: proto}; is a special form, unlike any other identifier __proto__ as the literal property name does

Re: Readdition of __proto__

2013-10-14 Thread Rick Waldron
On Mon, Oct 14, 2013 at 5:22 PM, Brendan Eich bren...@mozilla.com wrote: Rick Waldron wrote: Do you mean more then inclusion in Annex B? http://people.mozilla.org/~**

Re: Readdition of __proto__

2013-10-14 Thread Andrea Giammarchi
Allen my confusion is with o4 ... what happens once you re-set/assign its `__proto__` there? Is it just a normal property so new value will be set ? Is it a magic inherited thing (it shouldn't) that will change the o4 prototype chain ? On Mon, Oct 14, 2013 at 5:32 PM, Allen Wirfs-Brock

Re: Readdition of __proto__

2013-10-14 Thread Allen Wirfs-Brock
On Oct 14, 2013, at 5:54 PM, Andrea Giammarchi wrote: Allen my confusion is with o4 ... what happens once you re-set/assign its `__proto__` there? Is it just a normal property so new value will be set ? Is it a magic inherited thing (it shouldn't) that will change the o4 prototype chain

Re: Readdition of __proto__

2013-10-14 Thread Andrea Giammarchi
we are lucky enough there's no browser without a native JSON object that uses the D. Crockford polyfill ^_^ On Mon, Oct 14, 2013 at 6:20 PM, Allen Wirfs-Brock al...@wirfs-brock.comwrote: On Oct 14, 2013, at 5:54 PM, Andrea Giammarchi wrote: Allen my confusion is with o4 ... what happens once

Re: Readdition of __proto__

2013-10-14 Thread Andrea Giammarchi
(early sent) I meant passing through the prototype. The unmagic behavior is when you deal with such object thinking accessing its `__proto__` will behave like others. So it's the other way round but again, I know all of this, I was just confused by it and explained indeed with an example code how