Re: How to implement both object->method and module::function interface?
[email protected] (Graham Barr) Wed, 16 Aug 2000 09:08:32 +0100
| Newsgroups | perl.perl6.stdlib |
|---|---|
| Message-ID | <[email protected]> |
On Tue, Aug 15, 2000 at 03:17:36PM -0400, Chaim Frenkel wrote: > >>>>> "GB" == Graham Barr <[email protected]> writes: > > GB> On Tue, Aug 15, 2000 at 10:14:36AM -0400, Chaim Frenkel wrote: > >> As much as I'm not for it, would > >> > >> having > >> > >> sub foo :method {} # In objects vtbl > >> and > >> sub foo {} # only if procedural call > >> > >> being a valid construct and having perl dispatch appropriately, be > >> viable? > > GB> What does it mean ? Can the first only ever be called as a methoed and the > GB> second as a procedure ? Will we have to define both foo's ? > > That was my suggestion. And the _author_ if supplying a dual mode > module would define both. Either one in terms of the other in order to > save coding. Or if there were a good reason, two seperate versions. > > As I said I'm not enamoured of this suggestion. But it's a thought. That needs to be made on -language > Do you think perl can dynamically create one of the styles from the > other? There has been some suggestion of perl not putting the object in the argument list when calling a method, but instead having a special var. If that happens we should be able to test the special var for defined-ness to determine how we were called. Just a thought. Graham.