ES3 quasi incompatibilities
dhtmlkitchen at gmail.com
Sun Nov 11 19:36:50 PST 2007
On Nov 11, 2007 7:18 PM, Yuh-Ruey Chen <maian330 at gmail.com> wrote:
> Garrett Smith wrote:
> It's trivial to implement an efficient Set class even in ES3 (with
> certain restrictions on the "type" of the key) - just use objects which
> are pretty much specialized hash tables (maps from string to values,
> keys collides with prototype keys). For ES4, we have maps which are hash
> tables as bareboned as you'll get in the language. I'm not sure why you
> have all those |!Map.containsKey(lisx[i])| checks in your Map example,
> since they're totally unnecessary.
Where is the string value in something like:
I wrote an Array-backed sorted set before but ended up not using it. I
did not like all the runtime checks and found another way to do what I
wanted to do.
> A SortedSet is a bit trickier, because that would require some sort of
> binary search tree to be efficient. But it can be done.
Programming is a collaborative art.
More information about the Es4-discuss