From: "Peña, Botp" Date: 2007-09-11T19:01:36+09:00 Subject: Re: Bug in lambda? From: Robert Klemme [mailto:shortcutter@googlemail.com] # Actually the original issue was different IIRC, because the block was # defined in a scope which had the block parameter as a local variable # which is not the case in your example. nonetheless, it is still dangerous on procs/lambda these block arg var creeping scope just adds to the confusion and danger simple example (got this fr avi's post), botp@pc4all:~$ irb irb(main):001:0> irb(main):002:0* x="this is a test" => "this is a test" irb(main):003:0> fac = lambda{|x| if x == 0 then 1 else fac.call(x - 1) * x end} => # irb(main):004:0> puts fac.call(3) 0 => nil irb(main):005:0> quit botp@pc4all:~$ irb irb(main):001:0> fac = lambda{|x| if x == 0 then 1 else fac.call(x - 1) * x end} => # irb(main):002:0> puts fac.call(3) 6 => nil kind regards -botp