Sigh... why couldn't they drop the : like js?
{x:, y:} is a syntax sugar of {x: x, y: y}. {x:, y:} is a syntax sugar of {x: x, y: y}. x, y = 1, 2
puts x: x, y: y
# ==> {:x=>1, :y=>2}
puts x:, y:
# ==> {:x=>1, :y=>2}
puts x, y
# ==> 1, 2
Which would be inconsistent and annoying.(and knowing Ruby, I imagine there might be some syntactical ambiguities as well)
x:, y:
but couldn't they drop the : if there are braces to indicate this is a hash? {x, y} 5.times { x }
This could either call the given block 5 times, or pass a hash of :x => x as the first argument.https://dev.to/baweaver/ruby-3-set-literal-3fp9
Unfortunately it looks like I can't edit or delete that comment now. :embarassed: