head1 TITLE

The AUTOLOAD subroutine should be able to decline a request

=head1 VERSION

  Maintainer: Leon Brocard <[EMAIL PROTECTED]>
  Date: 02 Aug 2000
  Version: 1
  Mailing List: perl6-language
  Number: ?

=head1 ABSTRACT

In Perl 5, the first AUTOLOAD subroutine found in an object's heirachy
is used and any other AUTOLOAD subroutines higher up are ignored. I
propose that in Perl 6 we allow AUTOLOAD subroutines to decline a
request, which allows other AUTOLOADs to cope with it.

=head1 DESCRIPTION

AUTOLOAD is a very useful and handy way to handle cool and exciting
things, but as has been pointed out many times before, only one
AUTOLOAD can be called in the object's heirachy, even if multiple ones
exist. This is due to the fact that AUTOLOAD subroutines must do
something - they can not currently decline a request. I propose one of
the methods which has previously been discussed on p5p.

=head1 IMPLEMENTATION

Instead of calling the right thing or actually doing the right thing,
AUTOLOAD subroutines should return a coderef which will be run as if
it were the method called. If an AUTOLOAD subroutine does not wish to
cope with a method call, it should return undef. Perl would then walk
the OO heirachy and find the next AUTOLOAD to call, eventually failing
with an error if no AUTOLOAD method is found which will accept the
call.

=head2 $AUTOLOAD

While we're at it, it may be a good idea to remove the global
$AUTOLOAD variable and instead pass it as the first parameter of the
AUTOLOAD subroutine call.

=head1 REFERENCES

Some posts on p5p which I've yet to find again.

Leon
-- 
Leon Brocard.............................http://www.astray.com/
yapc::Europe - September 22-24 London - http://yapc.org/Europe/

... Error 404: .signature generator ran out of tuits

Reply via email to