[erlang-questions] Status of map pair support in dialyzer

Kostis Sagonas kostis@REDACTED
Tue Apr 12 09:59:20 CEST 2016


On 04/12/2016 12:48 AM, Richard A. O'Keefe wrote:
> Couldn't the syntax for "any map" be something like #{_}?

Disregarding for a moment that this most likely requires a change in the 
parser, this would buy us what exactly?

Currently, we have the following two ways to write the any map:

	map()
	#{_=>_}

Why introduce one more?  Save typing three characters? (or just one, if 
you compare with the first)

Besides, I think that #{_} is fundamentally wrong.  The notation [_] 
exists because _ is the shorthand of the any() type and therefore [_] is 
shorthand for [any()].  Lists are parametric on just one type 
(variable), but maps, which are key-value associations are on two. 
That's why #{_=>_} makes more sense than #{_}.

Another way of saying/seeing the above is that map() is a shorthand for 
map(_, _) in the same way that dict:dict() is a shorthand for 
dict:dict(_, _).  There is no dict:dict(_).


Kostis



More information about the erlang-questions mailing list