From: Holden Glova Date: 2002-05-08T19:39:00+09:00 Subject: Re: Why is this a SyntaxError ? -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Wed, 08 May 2002 21:57, David.Moriano@gmx.net wrote: > Hi, suppose this dummy class: > > class A > def <<(o = :_only_a_block_, &block) > return o if o != :_only_a_block_ > return block[] if block > end > end > > a = A.new > > Then, this is ok: > a.send('<<') { 'hello dummy' } => 'hello dummy' > > but this ... > a << { 'hello dummy' } => SyntaxError: compile error > > why this not? I would gather that the << is not being bound to the object a. The following seems to work: irb(main):017:0> a.<<() { 'hello dummy' } "hello dummy" irb(main):018:0> a.<< { 'hello dummy' } "hello dummy" Hope this helps some. - -- Signed, Holden Glova -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE82P97+mF116Lw2cQRAofXAJ99Ay7lO5xxE3+rj+rdd7pEfEZRrQCdGl4Z arrZrX3S6y+ua/5Inplxbrs= =HIJF -----END PGP SIGNATURE-----