|
|
| XP is just a number | |
| PerlMonks |
Re^4: Closure warning with Perl 5.14? ("my ... if ...;")by tye (Sage) |
| on May 19, 2011 at 17:02 UTC ( [id://905754]=note: print w/replies, xml ) | Need Help?? |
|
Yeah, I don't understand having a warning for "my ... if 0;" but not for other "my ... if ...", especially since the second construct is more likely to be a real bug. The warning for "my ... if 0;" should convey something along the lines of "stop doing that hack to get 'state' variables as we won't guarantee that it will continue to work". The warning for other "my ... if ...;" should convey "you've got a bug there; move the 'my' out from under the 'if'". It is silly to warn for something that actually works fine but in theory might stop working some day while silently accepting something that just indicates a mistake (I've never seen code that intentionally and correctly used the behavior of "my ... if maybe();"), and a subtle mistake that is easy to not notice in testing. The second case is much more deserving of a warning. - tye
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||