Re: setPrototypeOf vs obj.__proto__ assignment

2014-04-07 Thread K. Gadd
Is my understanding correct that __proto__/setPrototypeOf are still required if you want to do things like that with instances of Function? Or did Function's constructor finally get patched to let you set a prototype? On Mon, Apr 7, 2014 at 2:26 AM, David Bruant bruan...@gmail.com wrote: Le

Re: setPrototypeOf vs obj.__proto__ assignment

2014-04-07 Thread Andrea Giammarchi
nope, if you have a dict and you use __proto__ nothing should happen, that's why Object.setPrototypeOf is suggested: it's more powerful + it does not show up in getOwnPropertyNames as '__proto__' does so it's shenanigans and errors prone. __proto__ is not even more elegant than

Re: setPrototypeOf vs obj.__proto__ assignment

2014-04-07 Thread John Barton
On Mon, Apr 7, 2014 at 10:51 AM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: .. It feels like everyone uses `__proto__` on daily basis while ES6 promotes classes ... so either `__proto__` is not a real world use case, or `class` landed for no reason, IMO. You are correct, lots of

Re: setPrototypeOf vs obj.__proto__ assignment

2014-04-07 Thread Andrea Giammarchi
that's why it's the preferred choice ... otherwise we keep promoting and trapping developers behind a broken pattern. If we keep saying just use `__proto__` code won't ever migrate but it's been discussed that in some case `__proto__` is a very problematic keyword.

Re: setPrototypeOf vs obj.__proto__ assignment

2014-04-07 Thread Andrea Giammarchi
just for topic and documentation sake ... On Mon, Apr 7, 2014 at 11:02 AM, John Barton johnjbar...@google.com wrote: on platforms without setPrototypeOf(), it's advantages are not relevant. jjb this works in Firefox since quite a while, and probably some other engine that supports

setPrototypeOf vs obj.__proto__ assignment

2014-04-04 Thread John Barton
I was surprised to discover that in chrome at least this is valid: var obj = {}; obj.__proto__ = undefined; but this throws Object.setPrototypeOf(obj, undefined); Is it intended? jjb ___ es-discuss mailing list es-discuss@mozilla.org

Re: setPrototypeOf vs obj.__proto__ assignment

2014-04-04 Thread Allen Wirfs-Brock
On Apr 4, 2014, at 10:22 AM, John Barton wrote: I was surprised to discover that in chrome at least this is valid: var obj = {}; obj.__proto__ = undefined; but this throws Object.setPrototypeOf(obj, undefined); Is it intended? Yes, see the spec at

Re: setPrototypeOf vs obj.__proto__ assignment

2014-04-04 Thread Andrea Giammarchi
you probably meant this link too? http://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.setprototypeof 1. If Typehttp://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values (*proto*) is *neither Object nor Null*, then throw a *TypeError*