On Dec 21, 2010, at 2:12 PM, Brendan Eich wrote:

> I also see the ocap purity of soft fields, and I like Mark's 
> AST-decorated-sparsely soft fields use-case. But we already have weak maps in 
> harmony:proposals, so one can write such code now, just  at some loss of 
> convenience: without square brackets or (even better) dots for convenient 
> soft-field access expressions.

(I'm not sure where Mark's original AST use case is, or I would have also 
quoted it.)

To me, this use case sounds like a form of aspect oriented programming.  I'm 
not at all sure that AOP support is something we want to add as an additional 
requirement to our designs.  As Brendan points out, if you really want to do 
this, you can use weak maps whose inclusion I strongly support for exactly this 
sort of use case. 

However, why would you bother freezing your AST nodes in the first place.  
JavaScript has a great mechanism for "soft fields" -- it's called properties. 
You can even make your base  properties non-configurable if you want to.  But 
why make them non-extensible in this situation.   My sense that this is a great 
fear of an important segment of the JavaScript usage community.  That people 
will start arbitrarily freezing or otherwise locking down objects resulting in 
systems that are much less "elastic" then they are today.

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

Reply via email to