From: Sean O'Halpin Date: 2005-10-28T18:24:52+09:00 Subject: Re: Argument Passing Syntax On 10/27/05, gwtmp01@mac.com wrote: > Why are arguments to the '[]' method parsed differently > than a standard method? Because () and [] are parsed differently. [] is primarily an array reference (aref). You can't pass blocks either in 1.8. In 1.9 you will be able to do this: class O def [](*args, &block) yield(args) if block_given? end end o = O.new o.[](1,2,3) { |x| p x } # this is what you have to do in 1.8 o[1,2,3] { |x| p x } # this causes syntax error in 1.8 but works in 1.9 but not this (as far as I know): o[1,:var => 3] # syntax error in 1.8 & 1.9 Regards, Sean