From: "David A. Black" Date: 2005-08-06T23:08:33+09:00 Subject: Re: new block notation Hi -- On Sat, 6 Aug 2005, Trans wrote: > > Yukihiro Matsumoto wrote: >> Hi, >> >> In message "Re: new block notation" >> on Fri, 5 Aug 2005 19:56:06 +0900, "Trans" writes: >> >> |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). I'm still not seeing how [:] or [=>] conveys the notion of 'emptiness' better than {} Maybe it's just my new-punctuation allergy.... David -- David A. Black dblack@wobblini.net