develooper Front page | perl.perl5.porters | Postings from October 2003

Re: [perl #24250] "return" required in some anonymous closures

Nick Ing-Simmons
October 20, 2003 06:15
Re: [perl #24250] "return" required in some anonymous closures
Message ID:
Mark Jason Dominus <> writes:
>Dave Mitchell <>:
>> This isn't a bug, it's a feature :-)
>> sub () {$lexical} is a constant sub generator, ie each call to 'sub'
>> returns a new constant sub rather than a closure. 
>Oh well, so much for the principle of least astonishment.
>What's the workaround for this feature?

A. Don't give the () prototype (they don't do anything useful
   on dynamic calls anyway).
B. Add a return Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About