[erlang-questions] Maps single value access not implemented

Sina Samavati sina.samv@REDACTED
Mon Feb 10 13:10:14 CET 2014


Loïc Hoguin <essen@REDACTED> writes:

> On 02/10/2014 03:39 AM, Sina Samavati wrote:
>> Charles Irvine <chuck.irvine@REDACTED> writes:
>>
>>> I am wanting to experiment with Maps in R17, but just discovered that
>>> accessing a single value from a map is not yet implemented. I find
>>> this surprising. Isn’t this a most fundamental feature of a map data
>>> structure?
>>
>> Yes, this is.
>
> No it's not.

I should have said "This is proposed in EEP 43".

> Personally I find it completely unnecessary. Look at how records are
> used, people tend to match everything they need in the function head
> because it makes the code clearer. It'll be the same with maps. It'd
> really only be useful in the shell because there's no function heads
> there.

I absolutely agree on the idea pattern matching over Maps is clearer.
If single value access won't be implemented, we will need a bunch of function
helpers to play with Maps in shell (I don't know if such functions are
implemented or not).

>> Note that the latest version is *17.0-rc1* which means it is a _pre-release_.
>> We will probably see the complete implementation of Maps[1] in 17.0-rc2.
>
> No it will not be complete. Variables as key will most likely not be
> ready for R17. Large maps will also be slow. What you have now is
> pretty much what you will get, as the focus is on stabilizing what's
> done so far, rather than risk shipping breaking bugs.

I feel much better with that. I guess something in *EEP 43* made Maps complex,
I mean, we don't really need all those capabilities for Maps as proposed in 
_EEP 43_. For example (this is just a friendly feedback not a *complaint*),
I think the '=>' operator is enough for both adding a new key and updating an
existing key.


Thanks for correcting me, Loïc.

-- 
Sina Samavati
Software engineer

https://github.com/s1n4
https://twitter.com/sinasamavati



More information about the erlang-questions mailing list