On 02/10/2010 10:09 PM, artbot wrote: > hi, > > all the time i thought [] would be a shortcut for the corresponding > class method of the class Array, but after > > def Array.[](*args) > puts "blah" > end > > i still get > > a= [1, 2, 3] > => [1, 2, 3] > > and on the other hand > > a= Array[1, 2, 3] # or a= Array.[](1, 2, 3) > blah > => nil > > so what is the exact cause of the difference? You defined Array#[] and nothing else. > can I somehow redefine the 'global' [] No, you can't. That's special syntax - it's a constructor like "foo". Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/