Dominik Bathon wrote:

> > I'm getting some very strange behavior from a conditional statement --
> > I can;t imagine how it is happeneing and I wondering if I stumbled upon
> > some sort of bug in Ruby. Although I have no idea how it could even
> > occuer, perhaps someone else can see it. Here's the code:
>
> No, that is no bug, it' a feature ;-)

Oh, I love those kind of "features".... NOT!

> This is just the way Ruby (it's parser) handles local variables, but I
> think matz said that this will be made more "consistent" in future
> versions (i.e. if something is a lvar at some point in a scope it will be
> an lvar everywhere in this scope and you might get a warning for your
> above code, like "use of lvar before initialization")

Why does it do this and why is that a good solution? How unintuitive
can it possibly be? Why doesn't it just convert the refernce to a lvar
when it evaluates?  Why does the parser have to look ahead and
pre-judge the reference. You got code evaluating in a false condition
--so anti-dynamic!

Sigh. Okay so referncing it as a local var --EVEN IN UNEVALUATED CODE
changes a refernce to a local variable. Great! I was trying to take
advantage of the isomorphism of local vars and metods --which I thought
WAS a feature. So much for that.

Thanks Dominik,
T.