[Ironruby-core] ConvertTo vs Cast

Peter Bacon Darwin bacondarwin at googlemail.com
Tue Feb 5 09:15:48 EST 2008


What about this though?

 

class D

  def +(other)

    45

  end

  def coerce(other)

    [self,self]

  end

end

 

3 + D.new

=> 45

 

 

In Ruby 1.8.6:

 

Fixnum.instance_method("+').bind(3.0)

 

produces:

 

'bind': bind argument must be an instance of Fixnum (TypeError)

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/ironruby-core/attachments/20080205/cfd00e45/attachment.html 


More information about the Ironruby-core mailing list