Re: Flexible type hinting
| From: | Ilia Alshanetsky | Date: | Thu, 02 Jul 2009 12:43:43 +0000 |
| Subject: | Re: Flexible type hinting | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-44641@lists.php.net to get a copy of this message | ||
On 2-Jul-09, at 4:45 AM, Paul Biggar wrote:
On Thu, Jul 2, 2009 at 5:26 AM, Ilia Alshanetsky<ilia@ilia.ws> wrote:I'd rather use -int, then +int and make people who want loose typing do the extra bit, because native typing should be strict.1) Strict type hinting helps to solve bugs, both the ones made out of careless/missing validation as well as subtle logic bugs that often take hours to resolve. I can tell you that within a week of implementing type hints we've been able to identify 30-40 bugs within a period of day. Many of which would not have been detected with "flexible" type hints that Paul is suggesting here is one example:I think you might not have read what I suggested (it is different than the one I emailed to you privately). What you want is fully supported. If you must be passed an int, use the +int hint.