From: Eric Hodel Date: 2005-10-29T08:26:07+09:00 Subject: Re: Argument Passing Syntax On Oct 28, 2005, at 3:25 PM, gwtmp01@mac.com wrote: > On Oct 28, 2005, at 2:27 PM, Eric Hodel wrote: > >> Hash::[] is the only reason [1 => 2] is allowed, see: ruby-talk: >> 163033 > > I've looked through the parse.y file, so I understand the mechanical > reason why it doesn't work (it doesn't match the grammer) but I'm > not sure I've heard a design or philosophical reason why the grammar > is restrictive in this case. I haven't looked at it enough to > decide if extending the 'aref_args' construct would introduce > some ambiguity. It may be that it conflicts with the parsing of > literal arrays. IIRC, #[] and #call doing the same thing is a (relatively) recent addition to the language. Hash::[] has been in Ruby since the first rev of Hash. So it is possible it is simply an oversight. -- Eric Hodel - drbrain@segment7.net - http://segment7.net FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04