M
Mr. Big
Ruby 2.0 will include new syntax for hash literals: {a:3, b:4}. However,
one can leave off the {}s to create a hash. Current software uses this
for "faked" keyword arguments.
def my_meth(options={})
end
(1) my_methkeyword => 3) # Ruby 1.8
(2) my_meth(keyword:3, another_option:10) # Ruby 2.0
Won't this create confusion? Why must keyword arguments use the same
syntax as new hash literals? How about "=" for keyword arguments instead
(such as in python)?
one can leave off the {}s to create a hash. Current software uses this
for "faked" keyword arguments.
def my_meth(options={})
end
(1) my_methkeyword => 3) # Ruby 1.8
(2) my_meth(keyword:3, another_option:10) # Ruby 2.0
Won't this create confusion? Why must keyword arguments use the same
syntax as new hash literals? How about "=" for keyword arguments instead
(such as in python)?