Yukihiro Matsumoto wrote:
Hi,
>Nah, just use the _collection_ brackets for both array and hash. The
>parser can tell them apart:
>
> # array
> [ a, b, c ]
>
> # hash
> [ a=>x, b=>y, c=>z ]
> [ a: x, b: y, c: z ]Yes, if it isn't empty.
But that's easy enough to remedy:
[:] # empty hash
That said, I realize its atypical from most other languages. But Ruby
isn't most other languages. Ruby is a fully OOP agile language. Ask
yourself, what is a Hash? In a very real sense (real as in utility) it
is an Array of Associations. This is not to say I'm suggesting hashes
neccessarily be fully OOPized in this way, but it does show at least,
the syntax above is quite sensible. Not to mention the clarity it would
give to blocks/lambdas. Alas, I imagine that such a change would be
considered huge, and for that reason alone (although I imagine both
syntaxes could be supported in a transition), unfortunately, Not Going
To Happen(tm).
T.
···
In message "Re: new block notation" > on Fri, 5 Aug 2005 19:56:06 +0900, "Trans" <transfire@gmail.com> writes: