Hi again,

On Wed, Jan 14, 2015 at 1:21 PM, Andrea Faulds <a...@ajf.me> wrote:
> Hi Andrey,
>
>> On 14 Jan 2015, at 11:10, Andrey Andreev <n...@devilix.net> wrote:
>>
>> I don't understand why it should be a bad thing that the API author
>> forces rules on the consumer. The opposite is IMO fundamental to the
>> concept of an API - the rules specified by the author are a contract
>> that the consumer agrees to, and which allows for the whole thing to
>> work properly.
>>
>> In this form, I don't get any benefit from strict type checks, because
>> I only want them so that writing foo(int $bar) guarantees me that the
>> caller *passed* an integer. Instead, I'd have to NOT use a type hint,
>> and instead do an is_int($bar) check inside ... this beats the whole
>> purpose.
>
> Why? What is wrong with a caller choosing to use weak type hints? Either way 
> you receive an integer.

Because it's pointless. Why would I want strict checks if I only cared
for getting an integer? The whole point is that I care for what the
caller passed, that I want specifically a check instead of a cast.

Cheers,
Andrey.

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

Reply via email to