[erlang-questions] Maps

Loïc Hoguin essen@REDACTED
Thu May 16 12:38:27 CEST 2013


On 05/16/2013 07:43 AM, Richard A. O'Keefe wrote:
> Oddly enough, the EEP I've been working on (or at least Part 1, as I've
> split it into four parts) _is_ syntax decoupled from the implementation.
>
> Here's a copy of the current draft.  I'm about to go through the torture
> of adding Markdown, sigh.

If I understand right, you need '#[]' defined in the local module, and 
as such can only have one defined?

This is going to be annoying when you want to use this syntax on both 
records and JSON and some other structure in the same module.

Why not just have Erlang define a default function if one isn't 
available that does what people expect depending on the type?

  *  lists, tuples: integer N fetching nth element
  *  proplists: atom A doing a keyfind
  *  dicts, maps: any A doing an equivalent of a keyfind
  *  etc.

You'd still allow overriding it but it would do the sane thing by default.

-- 
Loïc Hoguin
Erlang Cowboy
Nine Nines
http://ninenines.eu



More information about the erlang-questions mailing list