possible excessive proxy invariants for Object.keys/etc??

Tom Van Cutsem tomvc.be at gmail.com
Wed Nov 21 12:42:46 PST 2012


2012/11/21 Mark S. Miller <erights at google.com>

> On Wed, Nov 21, 2012 at 8:55 AM, Allen Wirfs-Brock
> <allen at wirfs-brock.com> wrote:
> > [...] Essentially we could internally turn the [[Extensible]] internal
> property into a four state value:  open,non-extensible,sealed,frozen.  [...]
>
> First, my apologies for not yet finding the time to catch up on this
> thread. But I did want to encourage this particular idea. We may not
> be able to make this work out, but it would have many benefits if we
> could. For example, the "isFrozen" check in the Object.observe API
> would make more sense if this were a simple state rather than a
> pattern check. More later...
>

A lot of the complexity of the current invariant checks derives from the
fact that Javascript objects have (too) fine-grained invariants (i.e.
non-configurability at the level of individual properties,
non-extensibility at the level of the object, and all possible combinations
in between). This means we have to account for weird cases such as a
non-extensible object with all but 1 property being non-configurable (an
"almost-frozen" object).

If JS objects could be in only one of four states, things would be a lot
simpler to reason about. That said, I don't see how we can get there
without radically breaking with ES5's view of object invariants.

Cheers,
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121121/538ef2a0/attachment.html>


More information about the es-discuss mailing list