<div dir="ltr"><div dir="ltr"><div>> How do you feel about being able to pattern match on fun M:F/A?</div><div><br></div><div>I personally don't agree with the argument of being "inconsistent". The pattern matching syntax has always been a subset of the language and with specific semantics. For example: #{1 => 2} is a literal map but #{1 => 2} literally in a pattern will also match #{1 => 2, 3 => 4}. I also consider the fact "fun M:F/A" is a literal to be an implementation detail rather than part of the language specification.</div><div><br></div><div>Finally, I think pattern matching on fun M:F/A would lead to bad coupling (it couples to the function name). For example, imagine that I implement some function called "my_module:my_fun/1" which has some specific behaviour on "fun lists:keysearch/3". At first, a user of my API is calling it as expected:</div><div><br></div><div style="margin-left:40px">my_module:my_fun(fun lists:keysearch/3, List).</div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div><br></div><div>And imagine elsewhere the user has to use the same function, but the indexes are zero-based, so they have to wrap it like this:</div><div><br></div><div style="margin-left:40px">my_module:my_fun(fun(Key, N, AList) -> lists:keysearch(Key, N + 1, AList) end, List).</div><div><br></div><div>Those two functions will now behave in different ways, which would be extremely confusing. Sure, you can achieve this by doing the manual comparison with == (as with everything else) but I don't think we should be further encouraging this behaviour. I personally don't remember ever needing to compare function references. <br></div><div><br></div>--</div><div>José Valim</div><div><br></div></div></div></div></div></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
</blockquote></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
</blockquote></div>
</blockquote></div></div>