You shouldnt store properties on the prototype chain like that. Your
abusing Object.create as a shallow copy. Use a real shallow copy method.

On Nov 8, 2011 7:07 PM, "Felipe Gasper" <[email protected]> wrote:

On 11/8/11 12:37 PM, Axel Rauschmayer wrote: > > What’s the use case?
I thought I gave a pretty reasonable one before, but just in case:

In YUI, it’s impossible to use this otherwise-useful pattern:

--------- var base_config = { width: "600px" }; … var my_config =
Object.create(base_config); my_co...

>
> > Don’t forget that whenever you set a property, you only ever modify the
> > first object in the prot...
>

Right…that’s why gave() walks the prototype chain unless it finds the
property *on* the object itself.

> > The “own property” debate mainly exists, because objects are (ab)used
as > dictionaries. Then ...
I disagree. That’s actually the crux of what I’m getting at.

IMO, you actually do want “inherited entries”; what you don’t want are
specifically those things inherited from Object.prototype. Weeding out
*all* inherited properties assumes that there is no legitimate use case for
objects inheriting from other objects…which defeats the whole purpose of
stuff like Object.create().

-FG

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

Reply via email to