On Sat, 2008-01-05 at 15:59 -0800, Mike Lively wrote:
> > Because type hinting is supposed to limit what kind of variable type
> > is
> > allowed for a parameter. When you magically convert you kill the whole
> > idea of type hints and replace it with some magical function parameter
> > auto type conversion, which would be another hard to understand magic
> > feature of PHP.
> 
> This is one of the reasons I am not so sure I like the idea of type
> hinting for scalar types.
> 
> In a language like php where you often times have data coming in as a
> string no matter what, it seems like strict type hinting would be a pain
> in the neck to use effectively. If you start using 'int' type checks for
> functions you are going to want to be passing data from _GET, _POST, etc
> to, you will have to do is_numeric checks or something similar, so
> instead of saving this userland code (like people are arguing scalar
> type hints will do) you are just moving that userland outside of the
> function into the code calling the function. That doesn't seem like much
> of a win to me in the ease-of-use regard.

Please, everyone understand this: Type hinting is not intended to be
used for input. Only internal stuff. 

Forget $_REUQEST, $_POST, etc. Type hinting would not be useful for
these things, we all know this.

> That being said I still do agree with Stefan that changing the type of a
> variable would be aweful. I do know that for any purpose I have for
> additional type hinting would actually be solved by just introducing
> type hints for 'scalar' (read string or int) and 'resource'.
> 
> - Mike Lively
> 

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

Reply via email to