On Tue, Jun 11, 2002 at 02:41:04AM +0900, Kontra, Gergely wrote:
> Hi!
> 
> I've successfully redefined the + method, the <=> method in some
> classes, but when I tried the same with +=, it doesn't work.
> (I use ruby 1.6.6)
> 
> Eg.:
> class Hash
>   def +=(other)
>     {} # dummy
>   end
> end
> 
> gives:
> SyntaxError: compile error
> def +=(other)
>       ^
> (irb):5: parse error
> 
> Then, my Q is how to (re)define the += operator (method)).

It's simply not possible! 

When you define a + operator, Ruby automatically "adds" a += operator 
which behaves like a = a + b.

Regards,

  Michael