[Harmony Proxies] Proposal: Property fixing

Sean Eagan seaneagan1 at gmail.com
Thu May 5 08:38:19 PDT 2011


Further clarification:

The traps that have a property name parameter are...

getOwnPropertyDescriptor
hasOwn
defineProperty
delete
getPropertyDescriptor
has
get
set

The internal methods that these traps are invoked from could delegate
to their standard object implementations if the property name they are
passed represents a fixed property, and perform proxy logic otherwise.

It would be optimal to ensure that all the other traps ...

getOwnPropertyNames
keys
getPropertyNames
enumerate
iterate

... always include any fixed properties, but the associated validation
logic would be inefficient, and a solution along the lines of just
tacking the fixed properties on to the front is probably too
inflexible, so it is probably leave those traps alone with respect to
property fixing.

Implementation considerations:

Implementations could store fixed properties in an own properties
table just as they would for regular objects.  This table would not
need to be created unless and until any properties are actually fixed.
 When a proxy's "fix" trap is invoked, if this table already exists,
it just "becomes" the object's own property table, and then the
properties in the "fix" trap return value can be added to this table
as if via |Object.defineProperties|.

Bug fixes:

> Object.defineProperty(x, "foo", {value: "bar", configurable: false, writable: false, enumerable: true};

... should have had a closing paren, and ...

> // non-writable, but doesn't throw
> object.foo = "baz";

... should have been ...

// non-writable, but "set" trap still called
x.foo = "baz";


Thanks,
Sean Eagan


More information about the es-discuss mailing list