On Tue, Sep 7, 2010 at 11:02 PM, Mark S. Miller <[email protected]> wrote:
> Syntax aside, these are both semantic differences with ExplicitSoftFields.

Yes, that's correct.  It's certainly not our contention that Names
provide an alternative to every use of WeakMaps.  WeakMaps are a very
useful language feature, not least because it's possible to write
library functions like ExplicitSoftFields using them.  However, Names
serve primarily a different use case - when you want the
information-hiding guarantees that lexical scope provides while still
programming in a traditional JS style.  Names allow economical
expression of common OO encapsulation techniques, while maintaing the
ES programming model.

ExplicitSoftFields intentionally stores data away from the object;
Names stores the data with the object.  The latter is often much more
convenient and easier to reason about.  I know that when I've been
able to shift programs I've written from using soft fields to using
real fields, the gains in code comprehensibility were noticeable.
-- 
sam th
[email protected]
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to