Re:I don’t like the Ruby 1.9 hash syntax
by Argorak on Wednesday December 14, 2011 @03:18AM
(#3351089)
A bit of history: this syntax originally appeared in MacRuby and is used for the named parameters needed to call ObjectiveC methods:
person.setFirstName(first, lastName: last)
So, introducing it into Ruby 1.9 gave MacRuby the ability of hooking into valid ruby syntax to do its special thing.
As a wild speculation, it may also be used for named parameters, should they ever be introduced in Ruby.
Personally, i like it for exactly that case. I do not like it as a generic hash syntax for another reason: its easy to align the =>, but its hard to align the:.
As a wild speculation, it may also be used for named parameters, should they ever be introduced in Ruby.
Personally, i like it for exactly that case. I do not like it as a generic hash syntax for another reason: its easy to align the =>, but its hard to align the:.