On 7/10/2009 13:23, Giovanni Giacobbi wrote:
On Fri, Jul 10, 2009 at 02:44:52AM +0200, troels knak-nielsen wrote:
[...]
For example, instead of:

     function addFive(int $x) {
       return $x + 5;
     }

You would simply do:

     function addFive(is_numeric $x) {
       return $x + 5;
     }

Since $x is guaranteed to be numeric, it is safe to to arithmetic on
it. No reason to explicitly type cast here.

I like it too. Not only it solves the initial problem, but it also allows userland extensions. For example, the current patch does not provide checks for callables, but we already have is_callable in the core.

--
Ionut G. Stan
I'm under construction  |  http://igstan.blogspot.com/


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

Reply via email to