develooper Front page | perl.perl5.porters | Postings from February 2013

[perl #7560] variables being hidden

Thread Previous | Thread Next
From:
James E Keenan via RT
Date:
February 16, 2013 03:08
Subject:
[perl #7560] variables being hidden
Message ID:
rt-3.6.HEAD-27190-1360984132-465.7560-15-0@perl.org
On Tue Aug 21 00:21:40 2001, RT_System wrote:
> Interesting...  It could be tricky to tell the difference between
> John's
> 
> :> my $var1=0;
> :> foreach my $var2 (@allVars) {
> :>   if ($var2 eq $someValue) {
> :>      my $var1=1;
> :>   }
> :> }
> :> print $var1;
> 
> and some construct like
> 
> my ($true, $false) = (1,0);
> 
> in code where $false is never used, let's say.  It's a bogus example,
> don't shoot me :)
> 
> Is there any way we could detect that a lexical 
> 	1) hides another lexical
> AND   2) is assigned to but never used?
> 
> That would cover John's problem nicely, and probably wouldn't generate
> too many spurious warnings.
> 
> However, my knowledge of the internals isn't anywhere near where it
> would have to be for me to offer a patch, sorry. :(

Reviewing this 11-1/2-year-old ticket today, it seems to me that *at
most* what is being requested is a warning of some sort.

However, given that we have lived 11-1/2 years without this warning, I
don't see a strong case for it.

Other opinions?  Otherwise, I think this ticket should be closed.

Thank you very much.
Jim Keenan


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=7560

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