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

RE: Expunge implicit @_ passing

Thread Previous | Thread Next
From:
Garrett Goebel
Date:
August 27, 2001 16:02
Subject:
RE: Expunge implicit @_ passing
Message ID:
71BEC0D4E1DED3118F7A009027B12028010BDFF3@EXCH_MISSION
From: Ken Fox [mailto:kfox@vulpes.com]
> Michael G Schwern wrote:
> > Any time you want to implicitly pass @_, you can just as easily
> > *explicitly* pass it or use goto.

goto does screw up caller... so I wouldn't say *anytime*
 
> I never thought of using goto actually. "goto &$method;" actually
> looks clearer than the code I'm using. (Although with re-directors
> we want to minimize cost so the 10% penalty should be eliminated.)

sub foo { &{ $_[0]->{_foo} || $_[0]->can(_foo) } }

works just as well as

sub foo { goto &{ $_[0]->{_foo} || $_[0]->can(_foo) } }

and doesn't mess up code which relies on caller...


Thread Previous | 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