Expunge implicit @_ passing

2001-08-12 Thread Michael G Schwern

Odd feature of perl5:

sub bar { foo }
sub foo { print @_ }

print bar(It's Magic!);

When foo() is called as foo with no parens and no arguments, it
inherits @_ from it's caller.

This might have been originally introduced as an efficient way to pass
huge sets of arguments without copying before references were
introduced, but that's not a problem anymore.  foo(@_) or goto foo
works just fine.

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?


-- 

Michael G. Schwern   [EMAIL PROTECTED]http://www.pobox.com/~schwern/
Perl6 Quality Assurance [EMAIL PROTECTED]   Kwalitee Is Job One
You see, in this world there's two kinds of people.  Those with loaded
guns, and those who dig.  Dig.
-- Blonde, The Good, The Bad And The Ugly



Re: Expunge implicit @_ passing

2001-08-12 Thread Damian Conway

When foo() is called as foo with no parens and no arguments, it
inherits @_ from it's caller.
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?

It's alreday scheduled for termination.

In Perl 6, the expression Cfoo returns a reference to the Cfoo subroutine.

Damian