From: Albert Wagner Date: 2002-09-13T05:22:45+09:00 Subject: Re: not grasping the method overloading/multi-dispatch thing On Thursday 12 September 2002 01:40 pm, Phil Tomson wrote: > Currently if we need a method that does two different things based on > the type of an argument we have to do: > > def meth(s) > case s > when Integer > #do something > when Float > #do something else > end > end > > It _would_ be nice to be able to declare two meth methods as shown above > instead of having to test the type of the argument. My 2 cents: When I find that I am testing type, as above, then it usually means that it's time to refactor. Then you can have two methods with the same name, but in different classes, where they belong. > > However, I also agree with David that this could change the nature of the > language. I also suspect that there will be a performance > hit for all code even if you don't use method overloading. IF it could be > implemented in such as way as to not impact performance if you don't use > the feature, then I'd probably lean towards doing it. > > Phil