I worry when my computer languages exhibit the following kind of behaviour
This example fails! The block variable, far from being a local parameter in the block, actually exists in the same scope as the array a. to evaluate the block the procedure assigns to the variable a destorying the array.
# example 1 does not work
a = [2,3,4,5]
puts a.max {|a,b| a <=> b}
puts a.max {|a,b| a <=> b} #runtime error - a is now an integer
# example 2 works
def max(a)
a.max {|a,b| a <=> b}
enda = [2,3,4,5]
puts(max(a))
puts(max(a))
Bug or quirk? I think bug.