<div dir="ltr">Variable map key syntax is not supported in R17. It is scheduled for R18.</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 18, 2015 at 8:01 AM, 月忧茗 <span dir="ltr"><<a href="mailto:yueyoum@gmail.com" target="_blank">yueyoum@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><p>Can Pid be maps key ?</p>

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

<p>Bug build with maps module, Pid can be key.</p>

<pre><code><span>18</span><span>> 
</span><span>18</span><span>> </span><span>Pid</span><span> = self()</span><span>.</span><span>
<</span><span>0.39</span><span>.</span><span>0</span><span>>
</span><span>19</span><span>> #{</span><span>Pid</span><span> => </span><span>1</span><span>}</span><span>.</span><span>
* </span><span>1</span><span>: illegal use </span><span>of</span><span> variable </span><span>'Pid'</span><span> </span><span>in</span><span> map
</span><span>20</span><span>> 
</span><span>20</span><span>> </span><span>M1</span><span> = maps:from_list([{</span><span>Pid</span><span>,</span><span> </span><span>1</span><span>}])</span><span>.</span><span>
#{<</span><span>0.39</span><span>.</span><span>0</span><span>> => </span><span>1</span><span>}
</span><span>21</span><span>> 
</span><span>21</span><span>> #{</span><span>Pid</span><span> := </span><span>V</span><span>} = </span><span>M1</span><span>.</span><span>
* </span><span>2</span><span>: illegal use </span><span>of</span><span> variable </span><span>'Pid'</span><span> </span><span>in</span><span> map
</span><span>22</span><span>>                  
</span><span>22</span><span>> maps:get(</span><span>Pid</span><span>,</span><span> </span><span>M1</span><span>)</span><span>.</span><span>
</span><span>1</span></code></pre><span class="HOEnZb"><font color="#888888"><br><br><br><br clear="all"><br>-- <br><div><div dir="ltr">My GitHub<br><a href="https://github.com/yueyoum" target="_blank">https://github.com/yueyoum</a><br><br></div></div>
</font></span></div>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div>