From: Martin DeMello Date: 2002-12-04T08:48:27+09:00 Subject: Re: Ruby Book for People Who Aren't (Yet) Programmers Mauricio Fern?ndez wrote: >> puts 5.0/3 # -> 1.666666667 >> >> !Note: Each operator is actually several different methods, depending on >> the type of its left hand operand. The two we just saw are, in full, >> Integer#/ and Float#/. This is sometimes referred to as 'operator >> overloading'. > > Isn't it rather just an example of polymorphism (dynamic dispatch based > on the type of the receiver)? Anyway I don't think these terms need to be > introduced in a tutorial. I was trying to avoid the term 'polymorphism' - 'operator overload' at least looks like English :) And we do have to introduce at least the concept, to explain what's going on. How about this: !Note: The behaviour of an operator depends on the type of its left hand operand. This is because an operator is actually a method of the left hand object. Thus, (5 / 3) and (5.0 / 3) involve two different operators, whose full names are Fixnum#/ and Float#/ (read 'the / operator of type Fixnum' and similarly for Float). Maybe we should say 'class' instead of 'type' from the beginning, at that, and use the word type only informally, as a loose synonym for 'class'. martin