[erlang-questions] Inconsistent shadowing of variables in a fun
Richard A. O'Keefe
Mon Jan 30 00:17:56 CET 2017
On 30/01/17 11:06 AM, Robert Virding wrote:
> When defining a fun the shadowing of variables occurring in arguments is
> Why the difference? Shouldn't we be consistent in shadowing all variables?
I have always wished that Erlang did no shadowing at all.
case X+1 of X -> ooh ; _ -> ahh end.
(fun (X) -> ooh ; (_) -> ahh end)(X+1).
Call *that* consistent? I don't.
foo.erl:8: Warning: this clause cannot match because a previous clause
at line 8 always matches
foo.erl:8: Warning: variable 'X' is unused
foo.erl:8: Warning: variable 'X' shadowed in 'fun'
That warning about 'X' being shadowed?
LOVE IT LOVE IT LOVE IT!
More information about the erlang-questions