From: Friedrich Dominicus Date: 2002-09-12T15:19:30+09:00 Subject: Re: Multimethods (was Re: Larry Wall's comments on Ruby) matz@ruby-lang.org (Yukihiro Matsumoto) writes: > Hi, > > In message "Multimethods (was Re: Larry Wall's comments on Ruby)" > on 02/09/11, Dan Sugalski writes: > > |Multimethod dispatch is reasonably simple. It's when you have > |multiple methods with the same name, which are only differentiated by > |their method signature. At runtime, the types of the arguments are > |checked and you dispatch to the matching method. If no method > |matches, or more than one method matches equally well, an exception > |is thrown. > > In my definition, this is not multi-method, because a method still > belongs to certain class. I think you're right with your definition. And you are right with multi-methods go beyond that. But it's quite easy to understand, while using the used definitions for overloading. The edge is small I guess. AFAIK do not all function in C++ e.g do have to belong to classes. And therefor one could have multi-methods there too. It's just very unusual use I guess. > I call this "overloading method". I'm not > against overloading method. This is a terrible difficult area IMHO. I used it and found it useful sometimes on the other hand I'm convinced that use stand near the other. > This has power of multi-method, and > simplicity of ordinary method. It depends on how you think objects and methods to have to work together. Most OO langauge includes Ruby see methods as "element of an object" This does not hold for CLOS. You loose the tight relationship but gain a new level of flexibility. Till some years I was in the first boat (heavily influences by Eiffel) but now I sit in the other. If you like I invite you to check out the GoF book and see how having the latter simplifies the mentioned patterns there. Well I guess with ruby you do not need many pattern from the GoF book, that's due to the flexibilty of ruby. > Just like mix-in compared to MI. May be. I'm used to MI since years. I do not find mix-ins easier to understand nor more clear. It's a different approach which obviously work for you. Regards Friedrich