develooper Front page | perl.perl6.language | Postings from June 2005

Re: How much do we close over?

Thread Previous | Thread Next
From:
Chip Salzenberg
Date:
June 12, 2005 23:15
Subject:
Re: How much do we close over?
Message ID:
20050612225732.GM19372@tytlal.topaz.cx
On Sun, Jun 12, 2005 at 11:26:49PM +0100, Piers Cawley wrote:
>     sub foo { my $x = 1; return sub { eval $^codestring } }
>     say foo()("$x");

I'm pretty sure you meant single-quoted, and you perhaps might maybe
need a dot there:

     sub foo { my $x = 1; return sub { eval $^codestring } }
     say foo().('$x');

> I claim that that should print 1. Chip claims it should throw a warning about
> because of timely destruction.

More like an error from the eval: '$x: no such variable in scope'.
-- 
Chip Salzenberg <chip@pobox.com>

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