Hi!

You could just as easily say to do:

function foo($bar) {
        $bar = (int) $bar;
}
/.../

Why bother with either if that's the case? Why not add support for something 
like:


Indeed, why bother? Only reason I heard so far is documentation. Which applies to both cases, but as you noted, it could be part of docblock. It is easier to handle though it were part of the function definition (reflection, etc.) But in general, yes, you can do it manually. Strict typing though adds additional problem that you don't have a point to handle the failure - and don't talk to me about error handlers, they are useless in this situation as they are too generic to know what's actually being handled. With coercive typing it is true too, but there you have much more reason to expect success, since it would not trip on things like string<->int or int<->bool.
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

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

Reply via email to