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

Anton Lavrik alavrik@REDACTED
Mon Aug 29 08:08:48 CEST 2011


On Mon, Aug 29, 2011 at 1:02 AM, Kostis Sagonas <kostis@REDACTED> wrote:
> 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, thank you for the correction! I actually misread this sentence.

Anton



More information about the erlang-questions mailing list