From: Paul Brannan Date: 2002-09-13T04:19:55+09:00 Subject: Re: not grasping the method overloading/multi-dispatch thing On Fri, Sep 13, 2002 at 03:40:42AM +0900, 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 This isn't necessary; see Hal's example of another alternative (declare a method in the Integer and Float classes that gets called from meth(), so that meth() follows the same code path for whatever type you use). The downside is that you have to modify those classes in order for this to work. Paul