On 10/16/2012 02:51 AM, Amaury Bouchard wrote:
> 2012/10/16 Stas Malyshev <smalys...@sugarcrm.com>
> 
>>>> public DateTime $date;
>>>
>>> This is *real* progress, even if under the hood all it does is wrap
>>
>> I think it's a movement in wrong direction. Again, it is an attempt to
>> make PHP a strongly typed language, which would not work well in a
>> dynamic language like PHP, for reasons that were amply explained in 9000
>> discussions we had on this topic before.
> 
> 
> Not necessarily strongly typed. (sorry to land on this topic afterwards)
> As I see PHP, it's a language that can be used as an informal scripting
> language, but also as a rock-solid modern tool.
> Type hinting in parameters is a really good thing, and it doesn't
> transformed PHP in a strongly typed language.
> Doing the same for object properties (always optional) could be very useful.

The rule in PHP for any sort of type hinting is that it is only done for
non-coercable types. In cases where there is simply no way to recover
from passing the wrong type, it is good to catch it as early as
possible. Extending this to also cover scalar coercable types would be
disastrous for the entire ecosystem and would completely change PHP. And
the fact that it is "optional" means absolutely nothing because once
some piece of your system has "optionally" decided to use it you don't
have the option not to abide by it, and it certainly isn't a hint, it is
a strong type. You will end up casting every call to everything all the
time just to be safe.

-Rasmus

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

Reply via email to