On Mon, Jul 12, 2010 at 01:58:03PM +0200, Eirik Berg Hanssen wrote: > On Mon, Jul 12, 2010 at 1:08 PM, David Cantrell <da...@cantrell.org.uk>wrote: > > I suppose this exposes another bug: that you can compare different data > > types (in this case a number and a version) without an explicit cast :-) > I thought that was the Perl way. > if ("2" > 1) { > say 'Yup, "2" is (or, if you insist, functions, through coercion, as) a > number. Specifically, it "is" 2.'; > }
Yes, I know. Hence the smiley. Enforcing explicit datatype conversion would, however, have made it clear right from the start where the problem was, just like it can make all kinds of other bugs easier to find. Sometimes I wish I could turn on type checking in perl with 'use stricter' or similar and have to do all my own type conversions, in much the same way as taint mode forces me to verify the safety of my inputs before doing anything dodgy with them. Currently hunting for a suspected bug at work, which we think is caused by the difference between undef and 0. I'd love to have "type mismatch at lib/Wibble/Boing.pm line 231" in the logs! -- David Cantrell | Cake Smuggler Extraordinaire I caught myself pulling grey hairs out of my beard. I'm definitely not going grey, but I am going vain.