On 26 February 2015 at 17:48, Zeev Suraski <z...@zend.com> wrote:
>> From: Theodore Brown [mailto:theodor...@outlook.com]
>> 2. Strict types are important in some cases.
>>
>> I would *want* any value with the wrong type (even a string like
> "26")
>> to be flagged as an error when passed to a function expecting an
> integer.
>
>
> I agree completely;  However, such use cases like this are a lot less
> common than the situations where you do want sensible coercion to be
> allowed.


That's just not true on medium to large code bases, and if you think
that's true it's possibly an explanation of why you don't see why
people want strict types so much.

In most applications, the part of the code that is exposed to the
outside world and has to convert strings or unknown types into known
types is a very small layer at the outside edge of the application.

The vast majority of code written for non-trivial applications has no
contact with the outside world. Instead it only communicates to other
layers inside the application where the types required are fully
known, and so the parameters passed should already be in the correct
type. And so type coercion is at best unneeded, and usually not
wanted.

I can understand why people might only want to use weak types for
their code base, but for you to continually dismiss people's desire
for strict types after all this has been explained to you multiple
times is very depressing.

cheers
Dan

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

Reply via email to