[erlang-questions] Special syntax for dictionaries

Richard O'Keefe ok@REDACTED
Thu May 6 04:58:06 CEST 2010


On May 6, 2010, at 8:52 AM, Sergey Samokhin wrote:
> Actually I would prefer not to be limited by "keys are only atoms"
> rule (but still having pattern-matching functionality).

Remember what the frames proposal is FOR.
It is NOT a "dictionaries" or "hash tables" proposal or anything
even remotely like that.
It's a "clean replacement for the -record kluge" proposal.
To that end, _fast_ construction and matching and _low_ memory
requirements are "must haves".  The report explains this in some
detail.

There could well be some kind of pattern matching support for
dictionaries.  However, that's a DIFFERENT purpose with DIFFERENT
tradeoffs.

> For example,
> dictionary where keys can be strings is superior for representing JSON
> documents, that, say, can be fetched from MongoDB and have a lot of
> long strings as keys.

The frames proposal is NOT about JSON.
It's about replacing Erlang -records.

There are proposals on the table (again, one from Joe Armstrong,
and one from me that goes into some detail about implementation)
for allowing large numbers of possibly large atoms -- that one is
an EEP.  If/when that's implemented, frames would become usable
for JSON, representing those strings as dynamic atoms.  But that's
pretty much a lucky accident.

You might want to think about reducing the size of those JSON
keys in order to reduce transport costs.





More information about the erlang-questions mailing list