On Feb 10, 2010, at 13:10 , artbot wrote:

> hi,
>=20
> all the time i thought [] would be a shortcut for the corresponding
> class method of the class Array, but after
>=20
> def Array.[](*args)
>    puts "blah"
> end
>=20
> i still get
>=20
> a=3D [1, 2, 3]
> =3D> [1, 2, 3]
>=20
> and on the other hand
>=20
> a=3D Array[1, 2, 3]  # or a=3D Array.[](1, 2, 3)
> blah
> =3D> nil
>=20
> so what is the exact cause of the difference?
>=20
> can I somehow redefine the 'global' []

no. [1, 2, 3] is an array literal and part of the syntax. It does not =
invoke a method. Array[...] is, as you point out in the comment, a =
method invocation to Array::[](*items).