On Thu, 2008-01-03 at 12:51 -0800, 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.

But this is not all-out strict typing. This is simply checking types on
execution of a function. I wrote the patch to follow the exact same
model as array type hinting. The only difference is that instead of
checking if the value is an array, it checks if it is an integer,
string, bool, etc.

There aren't two code models here at all. You can have a function
parameter, or you can have a type-enforced function parameter. PHP
newcomers can just not use type hinting if they want but I don't think
this is a valid argument.

As for performance, you may have a point. However it is probably no
worse than array type hinting, and it's definitely faster than class
type hinting, which were both deemed useful for PHP 5.1.

> > Strict typing allows very little room for type conversion. This is
> > optionally hinting the desired type of a function parameter.
> 
> That's not what I am hearing here on the list.

Sorry I don't understand, what is it you are not hearing on the list?

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

Reply via email to