On Thu, Jan 03, 2008 at 10:36:15PM -0600, Gregory Beaver wrote:
> Hi all,
> 
> As someone who has dealt with many scripts written by others as well as
> many of my own in a large-scale project (PEAR).  I can say with absolute
> certainty that scalar type hints would not make my job easier.
> 
> In fact, it would make it harder.  Many of the functions I work with
> require varied input and almost always require some kind of validation
> of that input.  A built-in procedure that would either end execution
> with a fatal error or suddenly jump execution to a global error handler
> that has no idea of the context in which the error was triggered is
> almost as useful to me as a PHP extension that runs the pump on an

You are missing the point.
If you want your function to take an argument of arbitrary type, then
you simply don't give a type hint[**]

[**] I suppose that we might implement the type hint 'mixed' which would
have the same effect as no type hint. Some people might like this from
the 'internal documentation' point of view.

> Where is the increased value?  Saving a few keystrokes of validation? 
> No.  You still need to validate the input for range, or is_numeric() or

No. The point is NOT to save input ($_GET, etc) validation -- that will
still need to be done; the point is to help pick up programming errors
where you accidentally get the type wrong.

Granted: some idiots will use it as cheap input validation, but it is difficult
to help some people.

-- 
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

Reply via email to