From: Brian Candler Date: 2004-09-19T01:21:24+09:00 Subject: Re: Automatic class conversion / function overloading On Sat, Sep 18, 2004 at 12:17:57AM +0900, Markus wrote: > > Btw: you know that there are classes Rational, Complex etc. already, do > > you? > > Yes. But it's a convenient context for discussing the real issues > (why overloading isn't as needed in ruby, how duck typing reduces the > need for class-tests, etc.) since it's reasonable to assume that > everyone knows what the semantics _should_be_ and thus we can focus on > how they are best implemented. If you want to see an example of Ruby idiom in practice, just see /usr/local/lib/ruby/1.8/rational.rb (or wherever it is on your system) The stuff with #coerce I never 100% understood, but then I've never had to use it for any of my own classes. I've only ever seen it used for the various different ways of representing numbers. Regards, Brian.