K
kevin cline
This looks like a pretty serious bug. It seems that lambda-
expressions are not properly localizing their formal arguments:
bash-3.2$ ruby --version
ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]
bash-3.2$ cat lambda-bug.rb
a = 0
f = lambda { |a| a }
puts "a = #{a}"
puts "f.call(1) => #{f.call(1)}"
puts "now a = #{a}"
bash-3.2$ ruby lambda-bug.rb
a = 0
f.call(1) => 1
now a = 1
expressions are not properly localizing their formal arguments:
bash-3.2$ ruby --version
ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]
bash-3.2$ cat lambda-bug.rb
a = 0
f = lambda { |a| a }
puts "a = #{a}"
puts "f.call(1) => #{f.call(1)}"
puts "now a = #{a}"
bash-3.2$ ruby lambda-bug.rb
a = 0
f.call(1) => 1
now a = 1