develooper Front page | perl.perl6.language | Postings from August 2001

Expunge implicit @_ passing

Thread Next
From:
Michael G Schwern
Date:
August 12, 2001 14:36
Subject:
Expunge implicit @_ passing
Message ID:
20010812173606.B1695@blackrider
Odd feature of perl5:

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

    print bar("It's Mmmmmaaaaagic!");

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   <schwern@pobox.com>    http://www.pobox.com/~schwern/
Perl6 Quality Assurance     <perl-qa@perl.org>	     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"

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About