On 2011-07-12, Johannes Schlüter <[email protected]> wrote:
> On Sun, 2011-07-10 at 19:41 +0200, Nikita Popov wrote:
> > E.g. Writing
> >
> > class Evaluator {
> > public function eval() {
> >
> > }
> > }
> >
> > Does in no way create an ambiguity with the eval language construct
> > PHP implements.
>
> For a method this is correct. But for a normal function this is
> different:
>
> <?php
> function eval() {
> }
> eval(); // will call the language construct
> ?>
But what about this?
namespace Foo
{
function eval($name)
{
echo $name;
}
eval('matthew');
}
The manual doesn't really differentiate between language constructs and
functions, and as such, I can see somebody reading the namespace section
of the manual and feeling this should be valid -- but currently, it
results in a parse error.
It seems to me we need a context-sensitive lexer.
> And i consider it "strange" to allow different names for functions and
> methods. And yes I'm aware that
> $eval = 'eval'; $eval();
> would call the function.
>
> I fear consistency issues.
--
Matthew Weier O'Phinney
Project Lead | [email protected]
Zend Framework | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php