> The object |obj| has a property |foo|; the object |proto| has a property
> |foo|. The string "foo" appears as property names in two different objects.
> I don't understand what problem this will cause for developers. The object
> |obj| does not have duplicate properties, it has a unique value for each
> property name.
Depending on what you want, it’s not a problem.
>
>
>> I don’t see a simple way of “fixing” (property descriptors do have their
>> uses) Object.create().
>>
>> Just allow the second argument to be property descriptor *or* object.
>
> Problem: property descriptors are indistinguishable from normal objects, they
> *are* normal objects.
>
> If you pass a normal object to object.Create() you get an error message.
> Clearly they can be distinguished.
var obj = Object.create(proto, { p: { value: 42 } })
How would JS distinguish between the property descriptor { value: 42 } and an
object whose property "value" has the value 42?
--
Dr. Axel Rauschmayer
[email protected]
twitter.com/rauschma
home: rauschma.de
blog: 2ality.com
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss