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