On Thursday 03 January 2008 22:51:27 Stanislav Malyshev wrote:
> > In a way this is true, but I look at it this way. Some languages are
> > strictly typed, some are dynamically typed. PHP can have the best of
> > both worlds by having optional strict typing where desired, as well as
>
> I do not believe trying to both eat cake and leave it intact would do us
> well. Mixing strict and non-strict code would be a nightmare. Absence of
> static type control (necessary for interpreted language) would make
> strictly typed code less, and not more stable. Add performance penalty
> from type checking and effort would be required from PHP newcomers to
> understand two code models instead of one - and you get the worst of
> both worlds, not the best.

I am not convinced that using type hinting would issue a big performance 
drawback because of type checking, for the reason that it is already 
happening. We can already hint types for arrays and objects. And whenever I 
build function that accepts a scalar value, 90% of the time I have to write a 
check to make sure the value is acceptable for the operation that occurs 
inside the function. So no matter what, type checking occurs. And so far I 
have been able to write lightweight programs when it has suited me, with or 
without type checking.

It is especially in such cases where it would be helpful to skip the test 
myself, when I know that only the type of variables that I specify can be 
passed in. It is less and easier coding for me.

Also, as this has been mentioned several times already, using type hinting is 
completely voluntary. Hence, newcomers do not need to bother with it until 
they are ready to try it out. If it is required in a job, then it hardly 
matters because it is probably one of the simplest things they might demand 
from a PHP developer.

> That's not what I am hearing here on the list.
I did not get this comment.

Tomi Kaistila
PHP Developer

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to