Re: type hinting
| From: | Sam Barrow | Date: | Fri, 04 Jan 2008 16:54:35 +0000 |
| Subject: | Re: type hinting | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-34413@lists.php.net to get a copy of this message | ||
On Fri, 2008-01-04 at 17:41 +0100, Stefan Esser wrote:
> Good Morning everyone,
>
> one should not forget that type hinting has some clear advantages the
> anti type hinting advocates always try to forget...
>
> * the code gets smaller because not so many typechecks in every function
True.
> * because the code gets smaller it is faster executed (userspace
> typecheck is slower than "engine-space")
Very true, type hinting would be many times faster than using is_int,
etc. which puts to rest any argument that type hinting will be bad for
performance.
> * without all these type checks the code gets easier to read
Yes, more concise and compact without manual type checking.
> * with type hints byte code optimizer can optimize the code far better
> -> faster execution
> * with type hints static analysing tools that check for
> bugs/vulnerabilities can perform far better (intra procedural analysis
> gives more information)
Also true. Applications like PHPDocumentor could make good use of scalar
type hints.
>
> Stefan Esser
>