Ken Fox <[EMAIL PROTECTED]> writes:
> Michael G Schwern wrote:
> > I can't think of any reason why this feature is useful anymore, and it
> > can be a really confusing behavior, so what say we kill it in Perl 6?
>
> I've always thought is was pretty useful for implementing generic
> redirectors. I wrote a frame system that allows instances to over-ride
> class methods. The basic idea is
>
> sub foo {
> my $method = $_[0]{"_foo"} || $_[0]->can("_foo");
> &{$method};
> }
>
> The only thing I'd like to change is to make &foo a tail call instead
> of a normal function call. But I guess that would *really* confuse
> people.
Given that I'd *really* like to see information about 'whether this
subroutine was called in an OO fashion', I'd prefer to see:
sub foo {
my $self = shift;
my $method = $self->{'_foo'} || $self->can('_foo');
$self->$method(@_);
}
used. But I take your general point about 'goto &$method'.
--
Piers Cawley
www.iterative-software.com