On 2021-08-04 11:28 p.m., Ovid via perl5-porters wrote: > One question, how would it handle this annoyance? > > #!/usr/bin/env perl > > use strict; > use warnings; > > my @list = map { rand(50) } 1 .. 10; > my $matches = 0; > for (@list) { > $matches += $_ > 25; # ??? > } > print "Matches = $matches\n"; > > Yes, that's an abuse, but it's the kind of crud we see in the wild (and it > doesn't throw any warnings); As a further response, Something else we can do, and we can actually do this independently of the boolean type stuff, is add new warning types that trigger whenever an implicit type cast happens, such as when using a string as a number or vice versa. So though such casting behavior is well defined it can still warn if we consider that a bad coding design. In that case though we would also need to have canonical explicit conversion syntax/routines/operators such that one can replace the then-warning code, which would include idioms like "0+$str", with something that wouldn't warn because the conversion is explicit. -- Darren DuncanThread Previous | Thread Next