<div dir="ltr"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Hi,</div><div><br></div><div>Since a few releases, the value fun M:F/A (provided M, F & A are bound) is a literal. It can be read with file:consult/1 as well as erlang:binary_to_term/1.</div><div><br></div><div>Running OTP 22, funs can be compared:</div><div><br></div><div>eq(F) -><br>    %% Compiles & works as expected.<br>    F == fun lists:keysearch/3.<br></div><div><br></div><div>However MFAs cannot be matched:</div><div><br></div><div>%% syntax error before: 'fun'<br>fmatch(fun lists:keysearch/3) -> true;<br>fmatch(_) -> false.<br><br>cmatch(F) -><br>    case F of<br>        %% illegal pattern<br>        fun lists:keysearch/3 -> true;<br>        %% illegal guard expression<br>        X when X == fun lists:keysearch/3 -> true;<br><br>        %% illegal pattern<br>        fun lists:_/3 -> inte;<br>        fun _:handle_cast/2 -> resting;<br>        _ -> false<br>    end.<br></div><div><br></div><div>Is this intended?</div><div><br></div><div>I believe it would be interesting to allow such patterns as well as for fun _:_/_.</div><div>This could help in optimization through specialization and probably would make for some new approaches.</div><div>Among all funs only fully qualified funs can be expressed this way so this behaviour could be a bit surprising to some but MFAs are already comparable today so I'd say we're already halfway there.</div><div><br></div><div>Thoughts?</div><div><br></div><div>PS: it seems one is no longer able to log into <a href="http://bugs.erlang.org">bugs.erlang.org</a> with GitHub credentials as <a href="https://bugs.erlang.org/login.jsp?os_destination=%2Fdefault.jsp">https://bugs.erlang.org/login.jsp?os_destination=%2Fdefault.jsp</a> doesn't provide the option anymore. Is this normal?</div><div><br></div></div></div></div></div>