I just run over this a few times lately (it is a bit indirect because of not 
having much logic in the overall syntax, but probably not that bad), for PHPs 
list() construct I think it would be nice being able to cast the assignments on 
the fly:

    list((string) $name) = array(new SplFileInfo(__FILE__));

(yes this example is not very creative but should be enough for a brief 
illustration).

Would this be possible? I know some folks do not like list, but on the other 
hand, things like these don't work in PHP:

    $name = (string) ($array ? : [new SplFileInfo(__FILE__)])[0]

and having casting list list() can be handy then.

Is this hard to add to core PHP?

-- hakre


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

Reply via email to