nobu.nokada / softhome.net wrote: > At Wed, 3 Mar 2004 15:44:46 +0900, > Charles Comstock wrote in [ruby-talk:94119]: > >>Why is bar escaping the scope of foo? Is this a bug, or an unintended >>feature? Probably quite intentional; I quite often use it for dynamic (re)definition of methods and would be annoyed if it went away... I suggest if you need this behaviour, use a proc literal assigned to a local variable, thus: def foo(x) bar = proc do |n| n + 1 end bar.call(x) # or bar[x] end foo(5) # -> 6 bar(5) # -> wtf? I don't know what bar is. Tim. -- Tim Bates tim / bates.id.au