Separating a Hash type from Object
Brendan Eich
brendan at mozilla.org
Wed May 2 12:26:32 PDT 2007
On May 2, 2007, at 11:44 AM, Peter Hall wrote:
> I'm wondering what is so wrong with Hash.set(key, value) and
> Hash.get(key)....
Nothing's wrong, but the "rightness" of object literals in
particular, and . or [] for accessing values by key, will make
anything like this less successful than you might hope. Syntax is the
UI, it matters.
We actually started down this road at a recent meeting, and ran into
another, non-syntactic issue: often one wants weak reference support
for keys, and sometimes even for values. Flash's Dictionary class has
a "weakKeys" flag parameter to its ctor. There's lots of prior art
here -- Allen Wirfs-Brock cited Barry Hayes's Ephemerons (http://
portal.acm.org/citation.cfm?id=263733&coll=portal&dl=ACM), for example.
This complexity again made us shy away from any late-breaking
significant feature. Adding GC requirements on all implementations
needs to be done with care, and with enough time to implement and test.
/be
More information about the Es4-discuss
mailing list