One of the more complicated projects that I have undertaken was embedding the PHP library into Google's v8 in order to allow javascript to create and otherwise access PHP objects directly, without a form of bridge, and without any form of interpretation (outside of javascirpt that is). This required access to the zend tables of a PHP object, and all properties and methods of a PHP object were accessible directly in this way from javascript.
From this experience I also got a taste of the challenge of handling PHP data types within C (the lower level structures that is) in a way that is useful in a more dynamic, abstract level above. This was within javascript at this point, not PHP, but was still the value of the true, internal representation of a PHP object.
There are many challenges in these situations, including when it comes to comparisons. In the end though, at least in my opinion, it was more important to respect and adhere to the dynamic nature of PHP. This was a matter of function, not a matter of logical interpretation or intuitive perception etc.
The discussion of whether "0" == true needs to be based on what "0" really is. As a numerical type, 0 is the binary value for false. However, as a string, "0" is valid, non null, and non empty. So in the end, it's a matter of whether you think "0" should be seen as a string, a numerical type, or as third option, whether you should try to handle it as both in different situations. Each view has valid, empirical reasons for why one way is more or less useful than the other, yet in the end there is no real or "factual" answer to this, and will always come down to how you, I, and the other guy values "0".
Edit: Also keep in mind that comparisons are one of the most basic operation of a language. While it is possible to make comparisons more "intelligent", this requires more logic within the actual comparison operation itself. With the frequency that comparisons are used, this can cause a negative effect on performance, especially with string type. So even this side of the discussion would likely become a matter of preference and/or priority.
Edit 2: To answer the root of your question more fully, dynamic types need either a form of dynamic comparison or a larger variety of comparison operators.
- '==' alone will only suffice if the operation '==' performs is smart enough to know how to handle each type under all use scenarios, specifically if the left operand and the right operand are different types. The downside to the more dynamic operation is a likely performance hit. The smarter the operation is, the more noticeable the cost is likely to be.
- more forms of operators (such as the addition of '===') may seem foreign to people new to your language and will likely receive criticism.
- third option would be forcing appropriate comparisons for each type at all times, but this will sacrifice dynamism and will go against the goals of a dynamic language (at least in my opinion).
PHP tries to handle comparisons dynamically, but includes '===' to allow strict comparisons as well. The only other option would be to make the default comparisons 'smarter' which will cost performance.
While it's true that the additional operators add complication and dynamic comparisons leave room for error, a junior high student should be able to grasp the concept (and many do). '==' means that left and right operands can be different types, but can lead to different results in specific, defined situations. '===' means that left and right must be the same types. As for practice, it's better to use '===' when checking the return value of a function, as well as is_string, is_int, is_bool, etc. This is the downside of a dynamic language, and not doing so will likely lead to unexpected comparison results at times.
But in the end, a 'good' comparison will always follow a defined, documented behavior. A language can use Klingon for comparisons as long as the results are well defined.
how often do you really need to see which of two strings is lexicographically greater?
Umm... every single time you sort a list of strings, just off the top of my head.