On 2-Jul-09, at 9:23 AM, Robert Cummings wrote:
Ilia Alshanetsky wrote:
On 2-Jul-09, at 9:04 AM, Robert Cummings wrote:
Ilia Alshanetsky wrote:
Paul's proposal is some part does not make sense because it
allows weak type hinting, which should not be used if you need
type hinting. The whole idea about type hinting is definition
of strict interfaces, not loosely based one. That's just my
opinion, which admittedly I feel fairly strongly about.
It's a hint, not enforcement. IMHO hinting about something is not
strict, it's a suggestion.
Have you using existing array or class type hinting?
I have, and IMHO it makes more sense for strict checking (though not
too strict since super classes make sense) when objects are being
passed. But in the case of primitive datatypes where coercion
between types is well established and understood, I think it should
be a warning. PHP knows how to convert the string '1' to integer. It
knows how to convert 0 to boolean false. These were established many
years ago. On the other hand PHP does not know how to coerce (in a
sensible way) class FreakyDeaky to class GobbletyGoot.
It is not about what PHP can convert, in the past and if you use old
function parameter parsing api PHP will even convert arrays to
stirngs. Its about delivering to the function/method exactly what it
wants and not a close facsimile thereof.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php