On Nov 21, 2012, at 12:42 PM, Tom Van Cutsem wrote:

> 2012/11/21 Mark S. Miller <erig...@google.com>
> On Wed, Nov 21, 2012 at 8:55 AM, Allen Wirfs-Brock
> <al...@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.

Of course, I don't necessarily agree that ES5 has such a view of object 
invariants... ;-)

However, everything we currently have in ES5 maps to one of those fours states. 
 Do you actually care very much, form a reasoning perspective,  about a open 
object with some non-configurable properties.  Or an non-extensible object with 
with some configurable properties?  

Overall, I think having the four states makes the conceptual model clearer and 
might guide us in cleaning up the MOP.

Allen








> 
> Cheers,
> Tom

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to