Another strong use-case is functions with a custom prototype.

I would love to build whole apis with callable objects with their own
prototype chains.

On Oct 13, 2011 6:29 PM, "Brendan Eich" <[email protected]> wrote:

On Oct 13, 2011, at 1:17 PM, Brendan Eich wrote: > On Oct 13, 2011, at 12:43
PM, John J Barton wrot...
Hrm. Lost my "Second".

I was making an argument about utility based on the __proto__ de-facto
standard. That addressed "less useful".

For "non JavaScripty" I was thinking of saying "is too!" but that's just a
counter-assertion ;-). Really, __proto__ is controversial in full but not in
concept, so long as mutating an existing object's [[Prototype]] is
disallowed.

Object.getPrototypeOf is the "get" API in ES5. For the "preset" API we want
syntax at least, to avoid copying literals passed to a functional API. We
could have the functional API too but it differs in making a copy of
whatever object is passed in as the "RHS", as Jake just wrote. It would not
be Object.setPrototypeOf.

Anyway, it seems to me __proto__ is out there in most JS engines. It's used
enough that IE feels some heat to support. It is therefore "pretty useful"
and "de-facto JavaScripty".

But the more important thing to say is that __proto__ use-cases that do not
mutate [[Prototype]] of an old-born object are legitimate. One such use-case
is "array with custom prototype".

/be

> > >> I want to compose objects: >> var result = cookUpTheBehavior(goodies,
stuff) <| initializ...

> _______________________________________________ > es-discuss mailing list
> [email protected]...
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to