Separating a Hash type from Object

Lars T Hansen lth at
Mon May 7 04:47:31 PDT 2007

On 5/7/07, zwetan <zwetan at> wrote:
> On 5/7/07, Peter Hall <peter.hall at> wrote:
> > Zwetan,
> > This is what we are talking about. But the es4 spec cannot make
> > assumptions about an implementation's GC, which may (or may not) be
> > necessary - at least for weak keys - but it's getting late in the game
> > to have to find that out. That's a summary, but search the list
> > archives...
> >
> > In general ES4 cannot take things, just because they have been
> > implemented in Tamarin. ES4 is supposed to be
> > implementation-independant. There are many factors that could make a
> > feature harder or easier (or just more or less desirable) to implement
> > in a given implementation - choice of GC seems to be a big factor in
> > this instance, but there are plenty of others.
> >
> ok fair enougth, I was under the assumption that Tamarin will become
> a de facto block for any ES4 implementation.
> But what I was sugesting is merely add a predefined Dictionary class
> as what have been done with the ByteArray class

That is what is being discussed.  There is at present no credible
proposal for new syntax or a new primitive "Hash" type.

Peter Hall succinctly make the two important points: there are design
issues to be resolved (notably whether weak refs are required to make
a Dictionary useful), and probably more importantly, we're way past
any reasonable feature deadline.  (ByteArray was arguably accepted
after the feature deadline; but ByteArray was special, and violating
the deadline again does not make a bad situation good ;-)

Following is the proposed API for the dictionary class, note this
proposal has been *rejected* for ES4.  It would be rejected even
without the provision for weak refs.  I'm including it only to make
the point that, like a lot of other data structures, it can be
implemented in portable ES4 and does not need to be part of the
language.  (That happens not to be the case for ByteArray, whose
entire reason for existence is storage efficiency coupled with

class Dictionary.<K,V> {
    function Dictionary(weak: boolean = false)
    public function from(x : Object!)
    public function size() : uint
    public function get(key: K) : V?
    public function put(key:K, value:V) : void
    public function has(key:K) : boolean
    public function remove(key:K) : boolean
    iterator function get(deep: boolean = false) : iterator::IteratorType.<K>
    iterator function getKeys(deep: boolean = false) :
    iterator function getValues(deep: boolean = false) :
    iterator function getItems(deep: boolean = false) :


More information about the Es4-discuss mailing list