[erlang-questions] [ANN] Erlson - dynamic name-value dictionary data type and syntax

Kostis Sagonas kostis@REDACTED
Mon Aug 29 08:02:49 CEST 2011


On 08/29/11 08:35, Anton Lavrik wrote:
> On Mon, Aug 29, 2011 at 12:05 AM, Rapsey<rapsey@REDACTED>  wrote:
>> Looks great. Glancing at the code, erlson:from_proplist if your proplist key
>> is not an atom will not work, or will it? It would be nice if it
>> automatically converted from lists and binaries.
>
> Yes, erlson:from_proplist() accepts only atoms as keys. Otherwise, it
> would be inconsistent with property lists as defined by the
> "proplists" module. Here's a quote from the documentation:
>
> "Property lists are ordinary lists containing entries in the form of
> either tuples, whose first elements are keys used for lookup and
> insertion, or atoms, which work as shorthand for tuples {Atom, true}."

I really do not see how the above quote implies that keys are atoms in 
proplists.  My reading is that if tuples are used as properties, their 
keys can actually be any term.  You may be right, but not because of 
this quote.

Kostis



More information about the erlang-questions mailing list