Re:I don’t like the Ruby 1.9 hash syntax
by ericwaller on Wednesday December 14, 2011 @12:14AM
(#3350729)
I agree that the lack of ':' preceding a symbol is the most awkward part. Especially since it only works in object literals. It means that the expression
{ :test => 1 } == { test: 1 }
is true, but the expression
{ :test => 1 } == { test : 1 }
results in a syntax error. In other words
test:
is almost like a preprocessor directive for
:test =>
which is a strange expansion to have by default in a language.
{ :test => 1 } == { test: 1 }
is true, but the expression
{ :test => 1 } == { test : 1 }
results in a syntax error. In other words
test:
is almost like a preprocessor directive for
:test =>
which is a strange expansion to have by default in a language.