> 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 hierarchy and find the next AUTOLOAD to call, eventually failing
> with an error if no AUTOLOAD method is found which will accept the call.
A more general solution is to allow the AUTOLOAD to resume the dispatch
process. My forthcoming RFC on revamped subroutine dispatch will cover this.
I don't *dislike* your proposal, except that it interposes another layer of
indirection on a process that is already too slow.
> =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. For: general global drought, the fact that
> perlsub's argument "because, er, well, just because, that's why..." is
> a bit weak. Against: makes AUTOLOAD more complicated, breaking the
> "subroutine parameters end up as @_" paradigm (apparently).
This, I really like.
> =head2 UNIVERSAL->can
>
> This proposal has the added bonus that the UNIVERSAL->can method (or
> whatever replaces it) will now work with AUTOLOAD-ed methods, whereas
> in Perl 5 it used to fail.
But how would it know whether a particular AUTOLOAD can handle the requested
method without calling that AUTOLOAD and seeing what it returns? Oh, I get
it: it *would* call every AUTOLOAD it found until one of them returned
something? If so, the RFC ought to explain this explicitly.
Damian