Re: What do we need strict scalar type hints for?
| From: | Andrea Faulds | Date: | Thu, 05 Feb 2015 23:14:40 +0000 |
| Subject: | Re: What do we need strict scalar type hints for? | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-81973@lists.php.net to get a copy of this message | ||
Hi,
> On 5 Feb 2015, at 19:15, Dmitry Stogov <dmitry@zend.com> wrote:
>
> "works" and "fits" are different.
Fair point.
> Strict type hinting may help catching problems only at run-time.
>
> In PHP you almost never can do something ahead of time, because of run-time binding.
> You may only guess, analyzing the whole projects and performing type inference.
This is true to an extent. However, there are still some things you can catch ahead-of-time. One of
the things strict mode caught could’ve been noticed by a static analyser. The other probably
wouldn’t have been. Strict typing tends to be better for catching errors ahead-of-time, and I
think with return types it’ll get even better.
Thanks for your input.
--
Andrea Faulds
http://ajf.me/