On 03/09/12 15:51, Ivan Enderlin @ Hoa wrote:
I would like to know why? Is it a compiler related issue or just an
omission? Would it be interesting to fix it?
There are plenty of examples of this. One from my code:
Can't do this:
self::$views[$path]();
But I *can* do this:
$x = self::$views[$path]; $x();
This is because PHP has a very unusual (and IMO bad) system of
type-checking at parse-time, by only allowing some specific (although
quite varied) types of variable access, and combinations of these.
If nikic's idea to rewrite the parser to use an AST is done, I imagine
this could be fixed. We could also add extra rules, but I think fixing
the general issue is more important, since it's like plugging two holes
in a barrel full of water that's just had a machine gun fired at it.
--
Andrew Faulds
http://ajf.me/
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php