Re: How to implement both object->method and module::function interface?
[email protected] (Hildo Biersma) Wed, 09 Aug 2000 13:58:34 +0100
| Newsgroups | perl.perl6.stdlib |
|---|---|
| Organization | Morgan Stanley Dean Witter & Co. |
| Message-ID | <[email protected]> |
Bart Lateur wrote: > > No. I could agree that > > CGI->somemethod(@args); > > would do exactly the same as > > CGI::somemethod(@args); > > i.e. no difference between function calls and class methods, unless the > method explicitely wants to know. > > Why make module authors' life even more miserable? > > Passing the class/object in a magic variable, e.g. $SELF, instead of in > the arguments list, is one way. Yikes. Class method calls should perform inheritance, subroutine calls should not. Altering the language to make the two look the same is a bad idea, because it breaks, fatally, as soon as the class supports more than one object at a time. Instead of changing the language to make a crufty interface work, the interface should be changed... Hildo