Why is this? I'm not sure I understand where the gain is.
I guess that, for me, the cost of a few keystrokes involved in writing "if x == 0 then ..." vs. "if x then ..." never seemed to be worth the hassle of remembering false values. I've always found it preferable to make the comparison being made explicit.
I also generally dislike the practice of using reserved values to signify empty data, e.g. 0 for missing numerical data. I prefer to use ML-style option types, e.g. None vs. Some 0, and in a dynamically typed language, I'd just use the nil/().
On the web, all the data comes in as strings including numbers. So the comparisons work well the numbers in strings. The rest of the weirdness comes from PHP copying C and Perl semantics.
When I moved from Java to Python, I was sure that dynamic typing was the way to go, because the type system in the C/Java family is such a hindrance, while lacking the power of a mature type system as seen in ML or Haskell. When I moved from Python to ML, I was equally adamant about static typing being the way to go, because the ML type system is pretty awesome in terms of compile-time error-checking and documentation. Now that I'm learning Lisp, I'm open to the benefits of dynamic typing, or at least want to keep an open mind about the matter.
This makes sense. I guess a programmer who does a string => bool type conversion desires different behavior than one who does string => int => bool, so the fact that they produce different results ("foo" => true vs. "foo" => 0 => false) is part of the design.
I guess that, for me, the cost of a few keystrokes involved in writing "if x == 0 then ..." vs. "if x then ..." never seemed to be worth the hassle of remembering false values. I've always found it preferable to make the comparison being made explicit.
I also generally dislike the practice of using reserved values to signify empty data, e.g. 0 for missing numerical data. I prefer to use ML-style option types, e.g. None vs. Some 0, and in a dynamically typed language, I'd just use the nil/().