Can Pid be maps key ?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Can Pid be maps key ?

月忧茗-2

Can Pid be maps key ?

Build maps from #{} syntax, The error says Pid can not be key.

Bug build with maps module, Pid can be key.

18> 
18> Pid = self().
<0.39.0>
19> #{Pid => 1}.
* 1: illegal use of variable 'Pid' in map
20> 
20> M1 = maps:from_list([{Pid, 1}]).
#{<0.39.0> => 1}
21> 
21> #{Pid := V} = M1.
* 2: illegal use of variable 'Pid' in map
22>                  
22> maps:get(Pid, M1).
1





--

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Can Pid be maps key ?

Hynek Vychodil
Variable map key syntax is not supported in R17. It is scheduled for R18.

On Mon, May 18, 2015 at 8:01 AM, 月忧茗 <[hidden email]> wrote:

Can Pid be maps key ?

Build maps from #{} syntax, The error says Pid can not be key.

Bug build with maps module, Pid can be key.

18> 
18> Pid = self().
<0.39.0>
19> #{Pid => 1}.
* 1: illegal use of variable 'Pid' in map
20> 
20> M1 = maps:from_list([{Pid, 1}]).
#{<0.39.0> => 1}
21> 
21> #{Pid := V} = M1.
* 2: illegal use of variable 'Pid' in map
22>                  
22> maps:get(Pid, M1).
1





--

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions