Re: RFC 97 (v1) prototype-based method overloading
[email protected] (Peter Buckingham) Tue, 15 Aug 2000 09:09:39 -0700
| Newsgroups | perl.perl6.language.subs |
|---|---|
| Message-ID | <[email protected]> |
Chaim Frenkel wrote: > > >>>>> "PC" == Piers Cawley <[email protected]> writes: > > PC> Chaim Frenkel <[email protected]> writes: > >> Why would anyone want to select a different method based upon the > >> arguments. > > PC> Have you seen Class::Multimethods? This kind of despatch can be very > PC> useful. Of course, the existence of Class::Multimethods proves that it > PC> can be done already so there may be no need to put it in the core. > > You answered the HOW, not the WHY. > > The question for the audience is WHY, I would want to do this. > > (As a counterpoint. Dr. Myers argues very strongly against this.) > There are a couple of reasons for overloading. simple arithmetic operations, you can use plus(int, int), plus(float, float). another approach is to use genericity like in eiffel, and the templates in C++, which is probably better in the sense that you only have one function ie plus(<type>, <type>). peter -- "Speak loudly, and carry a beagle!" -- Charles Schulz