From: Mike Stephens Date: 2009-04-23T07:57:45+09:00 Subject: Back to Fundamentals Phlip wrote: > > That's "overloading", not "polymorphism". > Before this thread I thought I understood polymorphism. Suddenly confused, I went off to Wikipedia and there are all sorts of arcane stuff there. I'm impressed how many technical terms people can use. Here's what I think it means: You can declare procedures (and, by extension, operators) that have identical names (eg 'hire', 'sort', '+') but behave differently depending on the nature of the object concerned. This saves you generating unique names for each type of data. So polymorphic means 'behaving differently in different situations'. If this is the case (forget all the different ways you might achieve that), then Ruby must deliver mainstream polymorphism because it uses classes. A class encapsulates procedures and therefore allows names to be re-used. The appropriate behaviour is selected by the type of the object concerned. Again if this simplistic view is correct, your examples are not to do with Ruby and polymorphism, they are to do with making classes contain more than one type of object (and why would you feel entitled to do that?) -- Posted via http://www.ruby-forum.com/.