Property Descriptors as script compatible representation

David Bruant bruant.d at
Fri Nov 2 10:39:22 PDT 2012

Le 02/11/2012 16:39, Allen Wirfs-Brock a écrit :
> So, yes, in that case Object.getOwnPropertyDescriptor and
> Object.defineProperty need to pass through object level descriptors
> from/to the corresponding proxy traps which means they can't normalize
> via a property descriptor record.  So, it is perfectly appropriate for
> them to explicitly test if O is a proxy and act accordingly.   I
> think, this should be the only place where an explicit Proxy test is
> required outside of the actual proxy object specification algorithms.
For some time after this sentence I wondered what justified
Object.getOwnPropertyDescriptor and Object.defineProperty to have
special-casing for proxies.
The reason is that proxies have an additional ability that regular
objects don't: accepting custom attributes. More specifically, proxies
are expected to be able to regurgitate custom attributes on
Object.getOwnPropertyDescriptor after they've been set with

Then, I wondered why it matters that only proxies can do it. The reason
is future-proofing. If a property descriptor record accepts any key and
value besides the standards ones, then it may become impossible to
extend property descriptor records in the future by assigning semantics
to currently-unused field names.

Keeping property descriptor records as tightly defined is for the best
for the future.


More information about the es-discuss mailing list