On Wed, Jul 1, 2009 at 23:36, Paul Biggar<paul.big...@gmail.com> wrote: > On Wed, Jul 1, 2009 at 10:23 PM, Hannes > Magnusson<hannes.magnus...@gmail.com> wrote: >> On Wed, Jul 1, 2009 at 23:07, Paul Biggar<paul.big...@gmail.com> wrote: >>> So, what you're saying is, the patch already handles coercion? If >>> that's the case, then problem solved. >> >> The patch offers scalar type _hinting_. Not type _casting_. >> >> Type hinting in PHP works very simply: If the value doesn't type-match >> the argument information (arginfo internally) then it will be rejected >> and E_RECOVERABLE_ERROR thrown. >> >> In most circumstances that error is fatal. However. If the user >> chooses then he can ignore that error (by creating his own error >> handler) and continue the execution. >> >> Type _hinting_ is in no way related to type _casting_. > > > It should be.
function foo(string $str, array $arr) {} foo(false, "foobar"); You are saying that the first argument should be casted, but not the second? Or are you planning on breaking pretty much every single application using PHP5? >> Furthermore, the patch introduces couple of new types, "scalar" and >> "numeric". These are "magic types" and do value-to-real-type >> comparison. No type casting. >> The scalar type hint accepts strings, booleans, ints and floats. >> The numeric type hint accepts strings (that pass is_numeric()), >> booleans, ints and floats. > > > Yes. Therefore only the scalar and numeric types are useful. Nobody > wants to use an 'int' hint that fails on numeric strings. I do. I don't only deal with $_REQUEST stuff. I don't have the resources to go the Y! route. I write bunch of stuff in PHP. Real type hinting would help _alot_. > Also, I don't know what happens for string hints when you pass an > object with a __toString handler, but it should be allowed. Apply the patch and try? It would be neat if people would do a quick readthrough the patch before arguing against it :) -Hannes -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php