Not everything is about simplification or minimization. Much like serifs on fonts, syntax aids readability and therefore understanding. Not needing to study the wider context to determine if some collection declaration is a list or hash is invaluable to my time.
Clojure's Lisp roots make its minimalistic hashes possible. There is a possible reason for separators in a language that doesn't have special syntax for function application (e.g. function calls can be written as "foo bar" rather than "(foo bar)" or "foo(bar)"), but Ruby doesn't take advantage of it. Take this map:
{
foo: capitalize bar,
baz: sanitize quux
}
Without the punctuation, it would be very ambiguous: { foo capitalize bar baz sanitize quux }
Re:I don’t like the Ruby 1.9 hash syntax
by jcromartie on Wednesday December 14, 2011 @10:03PM
(#3354854)
I don't know about Ruby 1.9, but in 1.8, you can't do (for example):
{ :foo => rand 40 }
It requires parens. So Ruby seems to enforce some limit where it's too ambiguous.
Re:I don’t like the Ruby 1.9 hash syntax
by rayiner on Wednesday December 14, 2011 @04:49AM
(#3351262)
I cringe at the thought of whitespace as an infix operator...
That's not really the right way to look at it. Function application is just the default interpretation of two juxtaposed symbols. It's not any worse than "new MyObject()", which has whitespace acting just as much like an infix operator. There's no inherent reason why you'd need a special operator to apply "capitalize" but not "-" or "new" or "def". That's just how C does it, and by an accident of history most mainstream languages just parrot C by default.
They might be useful as separators sometimes, but why are the absolutely required? They seem like noise. Anyway... I'll stick with hashrockets because the colon at the end is just confusing.