<URL: https://rt.cpan.org/Ticket/Display.html?id=72505 > On 25. mars 2012, at 18:34, Eric Brine wrote: > On Sun, Mar 25, 2012 at 10:40 AM, Gisle Aas <gisle@activestate.com> wrote: > This was was perfectly fine code that I now had to change because of this warning. > > As you can see there are certainly valid uses of length(@array). I would prefer for that warning to not be there. > > There are certainly valid uses of numification of non-numeric strings, stringification of undef, deep recursion, ambiguous use of operators, etc, but those warn too. The criteria isn't whether it has valid uses or not, it's a question of how many time it's used, and for what percentage of those times it's used incorrectly. It's not so problematic for me that there are warnings for run-time conditions that might indicate errors. These are conditions that the programmer might not have expected and it's good to make her be explicit about it. But complaining about length(@array) is a pure static warning. If we don't want people to be able to say that, why not just make it a syntax error then? We can even introduce this using a feature to stay backwards compatible. I don't think I ever seen a program that use length(@array) incorrectly. Are we for instance able to point to code on CPAN that use this construct incorrectly? I'm sure there have been novice Perl programmers that have attempted to write length(@array) when they shouldn't, but the error would be pretty obvious from the result you get. --GisleThread Previous | Thread Next