Well, it's 3am and I can't sleep, so if this makes no sense, just try to be
understanding, ok?

:)

----- Original Message -----
I'm trying to overload Float#+, but I'm doing it wrong and it's breaking
Float#+.  For example:

>> require 'complex'
=> true
>> 2 + Complex(1,1)    # -> works fine
=> Complex(3, 1)
>> require 'poly'      # -> breaks Float#+
=> true
>> 2 + Complex(1,1)    # -> broken
NoMethodError: undefined method `plus' for #<Complex:0x1aa2d0>
        from ./poly.rb:216:in `plus'
        from ./poly.rb:216:in `+'
        from (irb):4
        from :0
>>

This is the code I'm using:

class Float
    alias plus  +
    def +(other)
      other.kind_of?(poly) ? other.+(self) : self.plus(other)
    end
end


I don't understand the error.  I defnined "plus" for Float, not for
Complex.  Does anyone know how I should be overloading this operator?
----------------------------

Is the Float code you posted the code on line 216 of poly.rb?  Also, 2 is
not a Float, of course!  Did you do that same sort of thing for Fixnum and
Bignum?  If you want, you can mail me your code and I'll take a look at it.
(I had to solve a few problems like this when I was working or that symbolic
math stuff I sent you earlier, so it's all fresh in my mind.)


Chris