At 14:48 24/05/2010, s...@geleia.net wrote:
Adding strict typing would be the largest
> inconsistency in PHP's core syntax, ever.
I disagree. The === operator already checks the type of the variables.
We can agree to disagree regarding the level of understanding the
average PHP developer has about zval.type - but it doesn't change my
opinion that strict type checking would be the biggest inconsistency
in PHP's core syntax ever. These two assertions are independent from
each other.
That said, I don't think strict type checking is the best option. I just
think it's better than inventing a new complex set of rules that are
inconsistent with everything else.
Suggest we put aside the 'is strict typing better than variant X of
auto-conversion or not' discussion since it's mostly academic. I
think we both agree that we need to find the best version of auto-conversion.
I think the best option is to align the type checking with
zend_parse_parameters (this is not the same as an implicit cast) and make
it stricter. This includes:
* disallow string to float/int when it contains non-numeric characters
(includes "123abc")
* disallow string/float to int when it causes overflow instead of the
current behavior (triple cast (long)(unsigned long)(long long)). "L" would
retain the current behavior.
Although a depart from backwards compatibility, I doubt this would cause
much brekage.
Sounds acceptable to me, that's along the lines of the 3rd option
which appears to be getting the most traction. I'd also no
conversion of arrays to scalars to that list.
Zeev
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php