Re: RFC 193 (v1) Objects : Core support for method delegation

[email protected] (Graham Barr) Tue, 5 Sep 2000 10:26:39 +0100
Newsgroups perl.perl6.language.objects
Message-ID <[email protected]>
On Mon, Sep 04, 2000 at 09:53:39PM -0000, Perl6 RFC Librarian wrote:
> The proposed delegation mechanism would work via a pragma:
> 
> 	use delegation
> 		attr1 => [qw( method1 method2 method3 )],
> 		attr2 => [qw( method4 method5 )],
> 		attr3 => [],
> 		attr4 => [],
> 		# etc.
> 		;
> 
> This would cause method calls whose names match an element in the first
> list to be delegated to the "attr1" attribute of an object. Likewise,
> calls to a method whose name appears in the second list would be
> forwarded to the "attr2" attribute of the object.
> 
> That is, calls like:
> 
>         $obj->method3(@args);
>         $obj->method5(@other_args);

Is this not just a module which creates the necessary subs in the calling
package ? The catchall can be done with an AUTOLOAD sub.

Graham.