On 03/09/12 17:18, Andrew Faulds wrote:
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.
Absolutely.
PHP has no AST? Why? For historical reasons?
--
Ivan Enderlin
Developer of Hoa
http://hoa.42/ or http://hoa-project.net/
PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis)
http://disc.univ-fcomte.fr/ and http://www.inria.fr/
Member of HTML and WebApps Working Group of W3C
http://w3.org/
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php