From: Stephen White Date: 2000-12-23T00:23:44+09:00 Subject: [ruby-talk:7952] Re: defined? problem? On Fri, 22 Dec 2000, David Alan Black wrote: > irb(main):003:0> if m then m = 123 end > NameError: undefined local variable or method `m' for # > (irb):3:in `irb_binding' > irb(main):004:0> if m then m = 123 end > nil That's a good one! > This feels like a rather dramatic (for Ruby) compile-time vs. runtime > contrast. What we're seeing here is the effect of Ruby's complex grammar affecting how quickly instructions can be resolved. By the time it's worked out the word "then" isn't a procedure with arguments, it's already gotten up to and resolved "m = 123". This means that Ruby's interpreter allows out of order resolution of code, possibly as a speed optimisation. Without looking at the code, that'd be my guess. :) -- steve@deaf.org