<div dir="ltr">Trying to have a comfortable syntax brings all sorts of special cases not covered. One should use == or =:= in a guard, or true = (X == #{}) which is ugly.</div><div class="gmail_extra"><br><div class="gmail_quote">2017-02-07 12:45 GMT+01:00 Joe Armstrong <span dir="ltr"><<a href="mailto:erlang@gmail.com" target="_blank">erlang@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Ten minutes ago I was happily recursing down a list and discovered<br>
to my horror that an empty map isn't an empty map.<br>
<br>
1> #{} = #{a => 1}.<br>
#{a => 1}<br>
<br>
The documentation actually says:<br>
<br>
<quote><br>
#{} = Expr<br>
<br>
This expression matches if the expression Expr is of type map,<br>
otherwise it fails with an exception badmatch.<br>
</quote><br>
<br>
So #{} is an empty map in an argument position but not an empty map<br>
in a pattern.<br>
<br>
So this is not a bug since the system does what the documentation says<br>
but it is very weird.<br>
<br>
Is there some deep reason for this that I've missed ??????<br>
<br>
Very Puzzled<br>
<br>
/Joe<br>
______________________________<wbr>_________________<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" rel="noreferrer" target="_blank">http://erlang.org/mailman/<wbr>listinfo/erlang-questions</a><br>
</blockquote></div><br></div>