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

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

From:
Dave Mitchell
Date:
October 20, 2003 06:15
Subject:
Re: [perl #24250] "return" required in some anonymous closures
Message ID:
20031020131207.GB2952@fdgroup.com
On Mon, Oct 20, 2003 at 08:58:05AM -0400, Mark Jason Dominus wrote:
> Dave Mitchell <davem@fdgroup.com>:
> > 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?

Remove the ()'s.

-- 
To collect all the latest movies, simply place an unprotected ftp server
on the Internet, and wait for the disk to fill....



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