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 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]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to