On defining non-standard exotic objects
bruant.d at gmail.com
Sun Dec 30 11:18:12 PST 2012
It's been suggested a couple times on the list that the hope for
non-standard exotic objects (ES6 terminology for ES5 host objects) is to
make them at most as powerful as proxies.
The current definition of exotic object says:
"Exotic objects may implement internal methods in any manner unless
specified otherwise; for example, [example]. However, if any specified
manipulation of an exotic object's internal properties is not supported
by an implementation, that manipulation must throw a TypeError
exception when attempted."
What about just removing this paragraph and state that any non-standard
exotic object must be an standard object (which include proxies)? As a
consequence, proxies would be the most powerful extension mechanism
allowed by the spec and a direct consequence would be that non-standard
exotic objects would just be at most as powerful as proxies and would be
subject to all invariant checks, etc.
Instead of having to freely redefine all some or all internal methods
(and potentially violate invariants), non-standard object specs would
just have to define the target and necessary traps.
More information about the es-discuss