[erlang-questions] Maps

Loïc Hoguin essen@REDACTED
Fri May 10 13:48:19 CEST 2013

On 05/10/2013 05:03 AM, Richard A. O'Keefe wrote:
>      Frames are optimised (pared to the bone, in fact) for use in
>      record-like ways.  They are somewhere between pathetic and
>      hopeless as general purpose dictionaries.

I think that's the bigger issue with frames. Are they worth spending the 
time implementing considering they are essentially a records 
replacement? Records work good enough for most purposes, with the 
exception of upgrades, which few people do anyway.

Maps have the potential to replace proplists, dicts, and also some 
record misuses, where an interface requires you to include a file to 
have the records definition (the file example found in the EEP is one). 
They're much more interesting to implement.

As far as I understand maps are not meant as a replacement for #state{} 

> (K) Frames only allow atoms as keys, maps allow any term.

Atoms are only good for record-like use or list of options. They are a 
minority in a reasonably sized application (Cowboy, 8k+ lines, for 
example). Maps on the other hand with keys as iodata() would be much 
helpful to store many things related to requests and responses, like 
headers, cookies and more, and to convert them quickly with maps 

> But it gets better.  In dictionary-like uses, you have *few*
> dictionaries with key sets that tend to be *different*.

Not my experience.

Loïc Hoguin
Erlang Cowboy
Nine Nines

More information about the erlang-questions mailing list