in reply to Warning about unused lexical variables
My (small) problem with this would be that the "unused" variable might still serve some purpose. Consider a compute_some_value() like one of these:
sub pay_attention { die 'void context' if ! defined wantarray; return rand; } sub side_effect { print "I am happy.\n"; return; } sub wait_for_destruction { return OnDestroyDo->new( \&side_effect ); }
In case that last one is not clear, the idea is that it returns an object that will perform some action when it is destroyed.
Arguably a warning is still warranted in even these cases, but it might not be easy to tell when an assigned value is really superfluous.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Warning about unused lexical variables
by xdg (Monsignor) on Sep 04, 2007 at 20:52 UTC | |
|
Re^2: Warning about unused lexical variables
by bart (Canon) on Sep 05, 2007 at 11:06 UTC | |
|
Re^2: Warning about unused lexical variables
by papidave (Pilgrim) on Sep 07, 2007 at 22:08 UTC |