On Sat, Jan 05, 2008 at 09:46:34AM -0800, Rasmus Lerdorf wrote: > PHP is first and foremost a Web scripting language. Everything we do > and every decision is based on that. For every feature the first > question you need to ask yourselves is: > > Will this make it easier or harder for the average PHP user to > build a web app? And if it makes it harder, is the extra pain > worth the benefit? > > Given that HTTP is still the dominant web protocol and given that HTTP > is not typed, we have to be very careful about introducing stronger > typing into PHP, even if it is optional. Passing $_REQUEST['age'] to a > function isn't a use-case that can be easily dismissed as it was by > someone earlier. This is the primary use case. PHP takes scalar user > data which comes across HTTP untyped, does stuff to it, and sends > something back.
Type hinting was never intended as a cheap/simple means of performing form validation. It is about accidentally passing the wrong type later on. > The argument that adding a type hint will make documentation easier is a > scary one for me. If we go and promote the use of runtime type hinting > in order for people to use auto-documentation tools, they are likely to > sprinkle these type hints everywhere which has the nasty side effect of > causing runtime warnings or errors when something returns 1 instead of > "1" whereas before this happily worked and worked correctly. And short "1" and 1 should both be acceptable to type hint 'int'. What this means is that the function is written in the assumption that $_REQUEST['age'] has been checked for numeric before the function is called. -- Alain Williams Linux Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer. +44 (0) 787 668 0256 http://www.phcomp.co.uk/ Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php Chairman of UKUUG: http://www.ukuug.org/ #include <std_disclaimer.h> -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php