-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

Alain Williams wrote:
> On Thu, Jan 03, 2008 at 12:21:21PM -0500, Sam Barrow wrote:
>> I think E_WARNING would be appropriate. That's what happens when you
>> omit an argument to a function right?
> 
> The other thing to note about type hinting is that it could result in faster 
> code.
> The value is checked and if needed converted (eg string -> integer) when the
> function is called; it then need not be converted again when it is used in
> the function. This will presumably be a win if the value is used more than 
> once.

I don't think that automagic conversion of types is a good idea.

When the type hint says I want an integer, then only integer should be
accepted; no casting should be done. It may give predictable results
according to the documentation but not always very intuitive. I sense a
possible small trap, and after all type hints should help developers get
code right and spot problems easier without less work.

PHP supports explicit casting and that should be used for that. Because
if this results in a problem alter in the code you know who to blame:
yourself, and not the automagic behavior of PHP.

my 2c,
- - Markus
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHfStA1nS0RcInK9ARAu/dAKDNOMC7M1X8CyrjyCrpzt0/oiLsCgCg2YSY
YAUYre0HTc3dLxsbHTu7+Ik=
=KXMz
-----END PGP SIGNATURE-----

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

Reply via email to