Re: Reviving scalar type hints
| From: | Stanislav Malyshev | Date: | Thu, 19 Feb 2015 07:23:50 +0000 |
| Subject: | Re: Reviving scalar type hints | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-83152@lists.php.net to get a copy of this message | ||
Hi!
> 2) PHP would benefit hugely from static analysis tools and compile-time
> type-based optimizations, but those are only possible with code that is
> strongly typed. Currently such tools do not really exist, but with
Is that really the case? Javascript has very good optimizing engine, and
Javascript has no typing. Of course, it is probably *easier* with strict
types, but harder and impossible are two very different things.
In fact, I do not see large benefits for static analysis from scalar
typing - execution path rarely is different depending on if something is
integer or string, except for obvious is_* check - but those are rarely
controlling any useful logic. It may be different depending on if it's a
scalar or an object - but that we already have covered.
--
Stas Malyshev
smalyshev@gmail.com