From: "David A. Black" Date: 2008-07-30T23:46:30+09:00 Subject: Re: How to do methodsoverloading in Hi -- On Wed, 30 Jul 2008, Shadowfirebird wrote: >>> Given that Ruby is typeless, I'm not sure how it would be otherwise. >> >> Ruby is strongly typed, dynamic, and extensible, permitting Monkey Patching. > > > Okay, *there* you caught me. I was grossly oversimplifying. Not grossly :-) Type in Ruby is kind of a tautology: an object's type is the type "the type of objects which are of this type." In the end, the notion of type kind of cancels itself out (or gets replaced by the notion of class, which it doesn't actually correspond to and which causes a lot of problems). > What I should have said was, Ruby isn't *statically* typed. Which > means that it can't use a parameter signature to tell different method > definitions with the same name apart. At least, so I understand is > the received wisdom -- I imagine only Matz could say for sure. People have written lots of libraries that try to examine method signatures, if not statically, then dynamically but in such a way that things will fail if the method is called with the wrong arguments. "Wrong," however, is almost always defined as "of the 'wrong' class", which of course doesn't play very nicely with the fact that Ruby objects have more on their minds than what class gave birth to them. There have been more elaborate attempts to check for type, rather than class, and some have been very interesting and educational; but they always end up feeling like a kind of second skin on top of what Ruby already does. David -- Rails training from David A. Black and Ruby Power and Light: * Advancing With Rails August 18-21 Edison, NJ * Co-taught by D.A. Black and Erik Kastner See http://www.rubypal.com for details and updates!