Simple maps/sets: parameterize the comparator?

Allen Wirfs-Brock allen at wirfs-brock.com
Thu Dec 29 10:04:19 PST 2011


On Dec 29, 2011, at 6:34 AM, Axel Rauschmayer wrote:

>> We should probably avoid pressures for the build-ins to cover all possible use cases. In ES.next we will should have all the primitives necessary for JS programmers to define their own efficient collection objects, including various kinds of hash-tables.  Hopefully some good libraries of such will get written.
>> 
>> I take it you are simply reiterating the desire for a standard system provided high entropy object-identity hash that is guaranteed to correspond to === and is.
> 
> I’m curious: Is it likely that such libraries will get written by the community? This domain does not seem to enjoy much interest. (I would volunteer, but have neither the necessary expertise/experience nor the time.)

Well, If nobody else creates such a library, I will.

I think up to now, JS has not been particularly hospitable to collection libraries, but this will be different in ES.next.

> 
> Can we profit from prior work? The following comes to mind:
> 
> - “User-extensible sequences in Common Lisp”, Christophe Rhodes
>     http://www.doc.gold.ac.uk/~mas01cr/papers/ilc2007/sequences-20070301.pdf
> 
> - Programming languages with collection APIs (among many others): Smalltalk, Java

See my experiments with Smalltalk-80 collections in ES.next at https://github.com/allenwb/ESnext-experiments .  However, if I was actually going to use Smalltalk collections as a model I would start with the ANSI Smalltalk collection specification http://wiki.squeak.org/squeak/uploads/172/standard_v1_9-indexed.pdf section 5.7

Allen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20111229/1580a25a/attachment.html>


More information about the es-discuss mailing list