On 07/04/2008, Christian Schneider <[EMAIL PROTECTED]> wrote:
> Just so this side was mentioned once again too: There are people who
>  consider type hints and especially scalar type hints A Bad Thing(tm) as
>  it is contrary to the PHP strength of dynamic typing and automatic type
>  conversion.

We are told that user data is dirty. Cleaning it is essential. One of
the simplest ways is to cast the data to the right type. If they enter
a date, then make sure it is a date by converting it to a date - if it
can't convert then it wasn't a date. Why would you retain the string
as your PRIMARY value? If you intend to do date manipulation you have
to convert it. To use scalars they have to be in the right type. I
cannot take 2 days from a string which is a date without having to do
some conversion.

The net result is that most user data should end up in the correct type anyway.

So at what stage does this dynamic juggling of scalars take place?

And why is it considered non-dynamic having a function declaration
tell third party developers the scalar type of the parameters should
be? If it was truly dynamic, they would be juggled for me rather than
have me do it in userland.

About the only time juggling is effective is in string concatenation.
And even then it misses booleans!  Do I get "true"/"false"? No I get
nothing or 1. So I have to process it.

Type juggling just doesn't seem to fit well with me.

-- 
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"

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

Reply via email to