On Sun, Dec 19, 2010 at 7:21 AM, Lasse Reichstein < reichsteinatw...@gmail.com> wrote:
> On Sun, 19 Dec 2010 08:39:00 +0100, Juriy Zaytsev <kan...@gmail.com> > wrote: > > __proto__ also appears to be marked as "deprecated" in current version of >> corresponding MDN docs. I wouldn't be surprised to see it go soon (if that >> doesn't break web too much). >> > > I'm afraid I don't see it going away any time soon. > For one thing, it probably will break some parts of the web (although I'm > happy > to see that, e.g., JQuery and ext.js don't use it). > Most definitely will break the web. Question is — how badly. __proto__ is non-standard, and it's been repeated hundreds of time — as part of web scripting best practices — not to rely on non-standard features (and prefer standard ones over them). But of course that's not how the web rolls :) > > Also, it provides a feature that ES5 doesn't yet: the ability to change an > object's > prototype chain. ES5 brought us Object.getPrototypeOf, but no > setPrototypeOf. > This was a conscious decision, as far as I know. Mutable [[Prototype]] carries performance overhead. I think that was one of the concerns of some of the TC-39 members. Mutable [[Prototype]] via "__proto__" also breaks other things. IIRC, there was a bug in V8 where JSON.stringify({ __proto__: [] }) serialized to "[]". This wouldn't happen with `Object.setPrototypeOf` but performance would still be an issue, I suppose. > > And it's widely supported: Firefox, Opera, Safari and Chrome, and people > are used > to writing around IE anyway. > It's extremely difficult to remove any feature that is already out there > and supported > by more than one browser. > Indeed. Well, Mozilla has already deprecated magic __count__, then removed it from FF4. I can imagine them removing __proto__ (or issuing a warning on access/assignment) under strict mode. Other implementations could be more problematic. Is Brendan on this list? [...] -- kangax -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google archive, visit here: http://www.mail-archive.com/jsmentors@googlegroups.com/ To unsubscribe from this group, send email to jsmentors+unsubscr...@googlegroups.com