From: Friedrich Dominicus Date: 2002-09-12T18:59:55+09:00 Subject: Re: Multimethods (was Re: Larry Wall's comments on Ruby) Dan Sugalski writes: > At 12:57 AM +0900 9/12/02, Christoph wrote: > >"Dan Sugalski" wrote in > >.... > >> That's pretty much multimethods. They're terribly useful, as they cut > >> out a lot of checks for the second type in methods. (Checks which > >> tend to be slow, error prone, and missing stuff) > > > >Thanks Dan, for making such an eloquent case for multimethods. > >Personal I cannot image (surely an effect of being single and > >simple minded;-) how their use could be less complex then the > >alternatives like Rubys coerce framework or double-dispatch .. > > Their big problem is that they introduce methods that don't live in > any class. If you have the methods: > > > add(int, num) > add(num, int) > add(bignum, int) > > those three, while methods, don't live in any class, so if you did: > > foo.add(bar) sorry any from the above has nothing to do with this one. you could have a foo.add(int,num) foo.add(num,int) .. and yo can have a foo.add(bar). > > you may well not be executing the add method defined in the foo > class--you may be executing the one defined in the bar class, or the > baz class, or maybe in some standalone code you loaded. Well I would not expect foo.add to comply to any from the functions above. Regards Friedrich