From: David Morton Date: 2007-06-02T13:20:46+09:00 Subject: Re: Is [ ] really a method ? -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Jun 1, 2007, at 10:42 PM, Vin Raja wrote: > Hi all, > > Well while running down the text I read that [] (used in case > Arrays and > Hashes) is actually a method called on that Array/hash object and also > that it can be overridden. > > well point taken. > > BUT if this is just another case of operator overloading then how come > we can call > > a[1]='item' > > rather than calling > > a[]1 ='item' > > (Anyways this gave me a syntax error) try: a.[](1) and a.[]=(1,'item') I'd say it is syntactical sugar for those methods.... David Morton Maia Mailguard http://www.maiamailguard.com mortonda@dgrmm.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Darwin) iD8DBQFGYOiQUy30ODPkzl0RAnigAJ9GYjaWL0oqfrQTW5gp1jIdSE7NgACfQJ34 g0x2F9TIfcHLYDbQm1QIWSY= =kMhu -----END PGP SIGNATURE-----