Re: type hinting
| From: | Alain Williams | Date: | Sun, 06 Jan 2008 22:22:49 +0000 |
| Subject: | Re: type hinting | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-34560@lists.php.net to get a copy of this message | ||
On Sun, Jan 06, 2008 at 11:15:43PM +0100, Stefan Priebsch wrote:
> Pierre schrieb:
> > I don't see the point to make a application working when you pass to
> > it the wrong data, it is a bad usage. That was the moto for the
>
> So how are you going to deal with the "bad usage" then? Isn't the
> problem that this "bad usage" is discovered at runtime, vs at compile
> time like in Java? If you don't deal with these errors, you effectively
> "crash" your application.
What 'fixup' can someone do ?
If a bad type gets in it is the result of a bug in the code.
We must provide the optional ability to trap to a function so that the
programmer can log the error in his own way and even, perhaps, invoke
some try/catch exception handling.
If the error function does not cause a try/catch exception the script
gets killed when the function returns.
What if type hinting wasn't used ? The program would continue and prob
do something stupid like putting a zero in some database column, or worse.
--
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>