[erlang-questions] Fwd: [erlang-bugs] Incorrect scope for a variable

Ola Andersson A ola.a.andersson@REDACTED
Thu Feb 17 13:24:04 CET 2011


There you are. 
That's exactly the reason why I don't like exports from case. 
Couldn't have found a better way to illustrate it if I had tried. ;-)
/OLA.

> -----Original Message-----
> From: erlang-questions@REDACTED 
> [mailto:erlang-questions@REDACTED] On Behalf Of Raimo Niskanen
> Sent: den 17 februari 2011 12:05
> To: erlang-questions@REDACTED
> Subject: Re: [erlang-questions] Fwd: [erlang-bugs] Incorrect 
> scope for a variable
> 
> On Thu, Feb 17, 2011 at 11:17:33AM +0100, Ola Andersson A wrote:
> > Are you sure about the example?
> > 
> > > > 1> {case 1 of X -> X end, case 2 of X -> X; _ -> 4 end}.
> > > > ** exception error: no match of right hand side value 1
> > 
> > I get:
> > Erlang R13A (erts-5.7) [smp:2:2] [rq:2] [async-threads:0]
> > 
> > Eshell V5.7  (abort with ^G)
> > 1> case 1 of X -> X end, case 2 of X -> X; _-> 4 end.
> > 4
> 
> X was exported by the line above so now X is bound.
> 
> > 2> {case 1 of X -> X end, case 2 of X -> X; _-> 4 end}.
> > {1,4}
> 
> Therefore that succeeded.
> 
> Try
>  1b> X.
>  1c> f(X).
> in between and watch the difference.
> 
> > 3> 
> > 


More information about the erlang-questions mailing list