<div dir="ltr">This is a current limitation with maps and bitsyntax. Variables has to be bound before being used as an expression in a pattern.</div><div class="gmail_extra"><br><div class="gmail_quote">2016-03-30 22:01 GMT+02:00 Luis Azedo <span dir="ltr"><<a href="mailto:luis.azedo@factorlusitano.com" target="_blank">luis.azedo@factorlusitano.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi,</div><div><br></div>this doesn't compile in 18.3. is it supposed to work with the maps spec ? maybe in a later release ?<div><br></div><div>-spec my_match(atom(), atom(), map()) -> any().<br><div>my_match(Classification, CarType, #{my_key := #{ Classification := #{ <<"cars">> := #{ CarType := Map}}}}) -><br></div><div>....</div><div><div>variable 'Classification' is unbound</div><div>variable 'CarType' is unbound</div></div><div><br></div><div><br></div><div>this works but we're not taking advantage of function clauses.</div><div><br></div><div>my_match(Classification, CarType, M ) -></div><div>    #{my_key := #{ Classification := #{ <<"cars">> := #{ CarType := Map}}}} = M,<br></div></div><div>    Map.</div><div>....</div><div><br></div><div>TIA</div><div><br></div></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" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div>