On Mon, Aug 27, 2001 at 10:48:55AM -0400, Ken Fox wrote:
> 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};
> }
Why not just $method->(@_); or &{$method}(@_); or goto $method?
Any time you want to implicitly pass @_, you can just as easily
*explicitly* pass it or use goto. As we're not doing pass-throughs
all over the place, it's not the sort of thing you want implicit, as
opposed to, say $_.
OH! Right, $_. Consider this.
sub foo {
my $arg = shift || $_;
print $arg;
}
sub bar {
$_ = 'from default';
&foo();
}
bar("from args");
What does that program do? Change &foo to foo() or &foo() and the
behavior changes. Ahh yes! Confusing, isn't it?
Why am I beating this dead horse?
--
Michael G. Schwern <[EMAIL PROTECTED]> http://www.pobox.com/~schwern/
Perl6 Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One
<mendel> ScHWeRnsChweRN sChWErN SchweRN SCHWErNSChwERnsCHwERN
sChWErn ScHWeRn schweRn sCHWErN schWeRn scHWeRN
SchWeRN scHWErn SchwErn scHWErn ScHweRN sChwern
scHWerN scHWeRn scHWerN ScHwerN SChWeRN scHWeRn
SchwERNschwERn SCHwern sCHWErN SCHWErN sChWeRn