From: Gavin Sinclair Date: 2003-12-29T06:57:39+09:00 Subject: Re: Inconsistent value of uninitialized variable On Monday, December 29, 2003, 4:29:45 AM, Nathaniel wrote: > On Dec 28, 2003, at 09:04, Gavin Sinclair wrote: >> This, to me, is inconsistent and undesirable behaviour. I would >> prefer this: >> >> x = x # NameError: undefined local variable or method `x' ... >> >> I haven't given it much thought, but the existing behaviour cost me 15 >> minutes debugging, and I: >> * don't see a benefit of the existing behaviour; >> * do see a benefit (consistency) of changing the behaviour. > Isn't it this behavior that makes it possible to define a recursive > block? > y = 0 > x = proc{y += 1; x.call unless(y == 100); y} > p x.call I don't believe so, because the 'x' in question above is not being assigned; 'x.call' is semantically equivalent to 'x' (an rvalue), not 'x = something' (an lvalue). What makes the above code possible is that 'x' in 'x.call' is not evaluated until it is actually run; there's no compiler to please. Gavin