From: Robert Dober Date: 2007-06-19T14:48:10+09:00 Subject: Re: local vars clobbered by un-run code On 6/19/07, Trans wrote: > > > On Jun 18, 10:35 pm, Yukihiro Matsumoto wrote: > > Hi, > > > > It's not a bug. Assignments makes identifiers local variables, > > statically. > > > > matz. > > This must be the matz-bot. The answer came instantaneously and, deja- > vu again, I think it's same one I got before ;) Let us see? Which assignment Matz? irb(main):001:0> def x;1 end => nil irb(main):002:0> if false then irb(main):003:1* def x; 2 end irb(main):004:1> end => nil irb(main):005:0> x => 1 irb(main):006:0> def y; 1 end => nil irb(main):007:0> if false irb(main):008:1> undef y irb(main):009:1> end => nil irb(main):010:0> y => 1 Surely the statements inside if are not executed. Cheers Robert -- You see things; and you say Why? But I dream things that never were; and I say Why not? -- George Bernard Shaw