Hi --

On Thu, 2 Mar 2006, Jeff Cohen wrote:

> Mr. Big wrote:
>> 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.
>>
>> Won't this create confusion?
>
> I am personally not in favor of allowing the : character instead of =>.
> (The last time I checked, this new syntax was marked as highly
> experimental and not a done deal yet).
>
> With colons already in use to denote the start of a symbol name, using a
> colon as a separator between a key-value pair is going to confuse many
> people, especially since everyone seems to like their own whitespace
> conventions.
>
> I hope Matz reconsiders and decides that the "experiment" is not worth
> it.
>
> As an aside, I wonder why => was chosen instead of a simple = sign.
> Seems like it's un-ruby-like to make us type the extra character :-)

I don't think it's extra.  I would hate to have to parse -- visually
-- things like:

   hash = { a = 1, b = 2, 4 = 5 }

etc.


David

-- 
David A. Black (dblack / wobblini.net)
Ruby Power and Light (http://www.rubypowerandlight.com)

"Ruby for Rails" chapters now available
from Manning Early Access Program! http://www.manning.com/books/black