Hello Stanislav, Thursday, April 17, 2008, 6:57:12 PM, you wrote:
> Hi! >> So: >> function foo($var) { if(!is_int($var)) { throw new exception('not int'); }} > What's the use of such code? If $var is '1' and not 1, what's the use of as this seems to be your only argument throughout the discussion, I suggest we implement is_numeric() and alike or allow a second parameter that to 'is_*($vaue, $strict=true)' that allows to switch to non strict mocde. We then could easily allow 'numeric' as another type hint. Or in other words I see this as a completely separate discussion. There are two discussions: a) do we want native type hints b) do we want an easy ability to deal with compatible types in type hinting marcus > throwing an exception and having to handle it later (basically by > failing the task, since you don't know how to do foo() now) - instead of > just doing with that 1 what was intended for? There's no any difference > between 1 and '1' that can be important to anybody. Only difference is > the way it is represented in underlying bits in zvals, about which > nobody should ever care. That's like making function that would accept > only arguments that has 3'rd bit of pointer set to 1 and 5th bit set to > 0, and reject all others. No sane application should ever behave this > way. Writing such function is just plain wrong, it replaces the > substance of programming with nitpicking over the details that are not > important. Whole phenomenon of dynamic languages has grown on the > principle of liberating people from caring for bits and concentrate on > substance, and now you try to drag the bits back in. >> which is called like this in both cases, maybe with a try catch etc etc: >> foo((int) $baz['bar']); > So every time you call foo you need try/catch? And that's supposed to be > _good_? > -- > Stanislav Malyshev, Zend Software Architect > [EMAIL PROTECTED] http://www.zend.com/ > (408)253-8829 MSN: [EMAIL PROTECTED] Best regards, Marcus -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php