New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve error messages for invalid expression in match #5649
Comments
It is not about being first-class, the issue is that For example, imagine you want to match exactly on the pid x = &List.first/1
case &List.first/1 do
^x -> true
end There are also cases like maps, where patterns and values are different. I believe there is very little interest in making functions valid patterns in Elixir. So I would recommend going the route of |
I see. Actually I found this when I tried to use such syntax, but I agree the case is very rare. Maybe I did not understand what Thanks for explanation! |
Ok, I will reopen this because we can definitely use a better error message. Plus using the term "expression" in there is not quite correct. |
case
condition, raising invalid expression in match
It was pointed out that `invalid expression in match` was unclear because the "expression" that is referred to should is not actually an expression. Since `case` can only match against a pattern it is clearer to say `invalid pattern in match`. Addresses Issue elixir-lang#5649 Amos King @adkron <amos@binarynoggin.com>
It was pointed out that `invalid expression in match` was unclear because the "expression" that is referred to should is not actually an expression. Since `case` can only match against a pattern it is clearer to say `invalid pattern in match`. Addresses Issue #5649 Amos King @adkron <amos@binarynoggin.com> Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
Environment
Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
Elixir 1.4.0
OS X El Capitan
Current behavior
however the other way works as expected:
Expected behavior
As a first-class citizen, function should work in
case
as it works in other pattern matching cases.The text was updated successfully, but these errors were encountered: