Coming from a python background, I'm used to running functions providing only the parameters that I need:
def f(a=1,b=2)
print a,b
f(b=3) #prints "1 3"
Ruby seems to provide the same syntax for optional parameters:
def f(a=1, b=2)
puts "#{a} #{b}"
end
But running f(b=3) prints 3 2 instead.
My guess is that it's evaluating b=3 before the function call occurs, and passing it as the first argument.
Is this interpretation correct, and is there a way to call a function providing arbitrary arguments?