Incorrect scope for a variable

Alexander Demidenko <>
Thu Feb 17 08:54:09 CET 2011


Dear friends!

Let me explain with an synthetic example.

Erlang R13B04 (erts-5.7.5) [source] [smp:2:2] [rq:2] [async-threads:0]
[kernel-poll:false]
Eshell V5.7.5  (abort with ^G)

1> {case 1 of X -> X end, case 2 of X -> X; _ -> 4 end}.
** exception error: no match of right hand side value 1

opposite successful example with bit change:
2> f().
ok
3> begin X=1, {case 1 of X -> X; _ -> 3 end, case 2 of X -> X; _ -> 4 end} end.
{1,4}

In first example, erlang assume X=2 in second 'case' (why?) and trow
exception before return tuple.

I'm think this is incorrect behavior. Isn't it?

--
---------------------------------------------
With best regards,
Alexander.


More information about the erlang-bugs mailing list