On Fri, 07 Jan 2011 17:29:23 +0100, jdalton <[email protected]>
wrote:
But I've heard Brenden Eich doesn't think __proto__ is a good idea
anymore.
__proto__ is great, has a long history of support (at least 13yrs),
and is now supported by every major browser (Safari, Chrome, Firefox,
Opera), except IE.
It has a long history and wide support, but I'm not sure I think it's
necessarily that great.
..
Because of that long history of support and increased adoption I think
__proto__ will be around for a while and that's a good thing.
I fear it'll stay around, but I hope it will be banished from Harmony.
Its functionality should be ECMA-ized and made part of the spec. It
could be under a different name, or made into a method, or extended to
respect property descriptors set on it, and so on.
Merely changing it into a method would be a great improvement. Having a
special property on all objects can get in the way of, e.g., using an
object as a generic map. It's great that you can detach the prototype,
so you don't inherit spurious properties, but then you have to special-
case if the user uses "__proto__" as a key.
I use __proto__ as one of the techniques to create sandboxed natives
(http://msdn.microsoft.com/en-us/scriptjunkie/gg278167).
Some of the newer/edge jazz (Object.create, proxies, Context) may
offer similar but not the same functionality.
As far as I know __proto__ is the only one that will preserve the
[[Class]] of the object.
It would be greate to have functions similar to Object.create that
created objects of different [[Class]], e.g., Array.create.
If we had all those, I don't think I would need __proto__ any more.
/L
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/[email protected]/
To search via a non-Google archive, visit here:
http://www.mail-archive.com/[email protected]/
To unsubscribe from this group, send email to
[email protected]