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

Re: explicitly declare closures???

Thread Previous | Thread Next
From:
Graham Barr
Date:
August 21, 2001 06:26
Subject:
Re: explicitly declare closures???
Message ID:
20010821142516.V7667@pobox.com
On Tue, Aug 21, 2001 at 09:21:35AM -0400, Eric Roode wrote:
> John Porter wrote:
> >
> >Dave Mitchell wrote:
> >> ie by default lexicals are only in scope in their own sub, not within
> >> nested subs - and you have to explicitly 'import' them to use them.
> >
> >No.  People who write closures know what they're doing.
> >
> >When's the last time someone "accidentally" wrote a closure?
> 
> People using mod_perl do it all the time:
>     http://www.perlreference.com/mod_perl/guide/obvious.html
> 
> I don't agree with the original proposal, since 'use diagnostics'
> will tell you about closures -- but people DO create closures by
> mistake, and it can be a very difficult bug to trace if you aren't
> used to closures.

You are refering only to one type of closure, nested subroutines. And
if people make these by mistake then perl will tell them with a
warning like

Variable "$x" will not stay shared

Graham.

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