[erlang-questions] Fwd: [erlang-bugs] Incorrect scope for a variable
Joe Armstrong
erlang@REDACTED
Thu Feb 17 15:32:50 CET 2011
On Thu, Feb 17, 2011 at 1:24 PM, Ola Andersson A <
ola.a.andersson@REDACTED> wrote:
> 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. ;-)
>
Yes but the alternative are nested letrecs which are much more verbose.
I like short code.
/Joe
> /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>
> > >
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>
>
More information about the erlang-questions
mailing list