I think the problem with the current rfc is:

test(42);
function test(string $a) does test((string)$a);
function test(array $a) does not test((array)$a); although casting would be 
possible.

So for consistency we might change the syntax or adapt array/object type hints 
with casting (BC-break).

Regards
Thomas


Rowan Collins wrote on 15.01.2015 23:09:

> On 15 January 2015 20:16:54 GMT, Thomas Bley <ma...@thomasbley.de> wrote:
>>What about doing both weak and strict with two different syntaxes?
>>
>>public function __construct(string $name, $age as int, $cuteness as
>>float, bool $evil) {
>>
>>string $name // strict
>>$age as int // weak
>>$cuteness as float // weak
>>bool $evil // strict
>>
>>"as" Syntax is taken from SQL92.
>>
>>Regards
>>Thomas
> 
> This is what some are proposing, but with slightly different syntax choices,
> inspired by existing cast operators:
> 
> public function __construct(string $name, (int) $age, (float) $cuteness, bool
> $evil)
> 
> Like literally every proposal in this area, some people think it's The
> Solution, others absolutely hate it. 
> 
> Andrea has stated (if I'm not paraphrasing too badly) that a major reason for
> putting the caller in control, not the definer, is that it's easier to reason
> about code where all the calls you are looking at follow one behaviour,
> regardless of where they were defined.
> 
> 
> -- 
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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

Reply via email to