Tom Christiansen wrote:
>
> >Same thing. If $x is lexical, it gives a definite warning. If $x is a
> >global, it says nothing. You're right; I need to point this out in the
> >RFC.
>
> Careful:
>
> sub ouch {
> my $x;
> my $fn = sub { $x++ };
> register($fn);
> print $x;
> }
Thanks. I forgot about that one. So either I can punt and treat
capturing a lexical in a closure the same way I'd treat taking a
reference (i.e., assuming that it's both initialized and used), or get a
little more clever and say that getting captured in a closure means you
have to throw out all beliefs about control flow, and fall back to
counting the number of uses and initializations.
Anything else? Any opinion on whether eval "" should do what it does
now, and be invisible for the purposes of this analysis; or if it should
be assumed to instead both use and initialize all visible variables? The
former produces more spurious warnings, the latter misses many errors.
- RFC 12 (v2) variable usage warnings Perl6 RFC Librarian
- Re: RFC 12 (v2) variable usage warnings Tom Christiansen
- Re: RFC 12 (v2) variable usage warnings Steve Fink
- Re: RFC 12 (v2) variable usage warnings Tom Christiansen
- Re: RFC 12 (v2) variable usage warnin... Steve Fink
- Re: RFC 12 (v2) variable usage warnin... Bart Lateur
- Re: RFC 12 (v2) variable usage warnings Dave Storrs
- Re: RFC 12 (v2) variable usage warnings Eric Roode
- Re: RFC 12 (v2) variable usage warnings Steve Fink
- Re: RFC 12 (v2) variable usage warnings Tom Christiansen
- Re: RFC 12 (v2) variable usage warnin... Steve Fink
- Re: RFC 12 (v2) variable usage w... Tom Christiansen
- Re: RFC 12 (v2) variable usa... Steve Fink
- Re: RFC 12 (v2) variable... Tom Christiansen
- Re: RFC 12 (v2) variable... Steve Fink
- Re: RFC 12 (v2) variable... Tom Christiansen
- Re: RFC 12 (v2) variable... Daniel Chetlin
- Re: RFC 12 (v2) variable... Steve Fink
- Re: RFC 12 (v2) variable usage warnings Dave Storrs
- Re: RFC 12 (v2) variable usage warnings Steve Fink
- Re: RFC 12 (v2) variable usage warnings Eric Roode
