[erlang-questions] Maps

Richard A. O'Keefe ok@REDACTED
Mon May 13 07:22:32 CEST 2013

On 11/05/2013, at 1:41 AM, Natesh Manikoth wrote:

> Erlang newbie here. This comment therefore is not about the merits of the proposals. 
> I detect a certain tendency to dismiss suggestions if the suggestions are not germane to that particular user's current (or past) needs.

The way I see it, we need *BOTH* a good replacement for records (which are
pretty much ubiquitous in OTP) *AND* a top notch implementation of dictionaries.

I don't just think it *can* be both, I think it *should* be both.

One thing I note about dictionaries is that sometimes I want hashed
dictionaries and sometimes I want sorted dictionaries, and when I
want sorted dictionaries I often need to provide my own comparison
function.  (Java has HashMap and TreeMap.  My Smalltalk has
Dictionary and SortedDictionary.)  The fact that I want more than one
kind of dictionary and that I want more than one kind of hashing+equality
(does string case matter?) or sorting (ascending or descending? what fields)?
Suggests to me that no one kind of dictionary, however, good, should be
privileged with special syntax, unless they _all_ can be.

Just today, in the space of a few dozen lines of Java code, I found myself
juggling both hashed and sorted sets and maps, with three different kinds
of keys/elements.

Given the possibility of a top notch implementation of dictionaries,
a top notch implementation of sets should not be far away (hint hint).

More information about the erlang-questions mailing list