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
inflatable chicken (at least the inflatable chicken extension has some
momentary amusement value).

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
some other fancy business.  Easier error handling?  Most definitely
not.  Most of the time, I throw an exception, how is an E_FATAL or
E_RECOVERABLE_ERROR going to help me here?  False sense of security
because it limits input to a particular type?  perhaps, but the key word
here is "false."

type hints might be more useful if they threw an exception, but even
then I would rather do that explicitly for the obvious reason that I may
not be the maintainer of my programs forever and someone else is going
to have to figure out why this exception was thrown.  The backtrace will
reference an actual line number with the word "throw" on it if I do it
myself, and will be magical if not.

In short, could we please move on from type hinting, I am a big -1 for
so many reasons, it gives me gas just to think about them all at once.

Thanks,
Greg

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

Reply via email to