Hi,

Watching my thread devolve into a blamefest wasn't the intention. I just wanted a clear answer if something's done about it or not.

To everyone participating in the thread: guys it's NOT trivial in the current situation. To the parser, a separate string matching a keyword is the token keyword.

Reverting this or making it context sensitive is not trivial by any means. Still though: it IS possible, you'll find plenty of examples of context-specific keywords in other languages (including C# which was quoted here).

Oh and btw, greg, in your example: you should print "1".

There's one trivial solution: make the keywords and class names case-sensitive. Then classes "If", "Array", "Interface" will never class with the all-lowercase keywords. I have to say, we sorely do need consistency on that front as well, and since vars are already case sensitive, making it all case sensitive is one way to go forward.

Why is this a problem at all? Well as people said, in .NET words like "array" are not a reserrved word.

Even more, if I have Foo.Utils.FooUtils, that's some redundancy I can easily avoid in .NET by "using Foo.Utils.*". In PHP, we can't do star-imports since the parser doesn't know what's there to import at runtime. So we can't easily avoid the redundancy, unless we manually import the classes we want to use, one by one.

So that's one more hassle which make redundant names a pain.

Regards,
Stan Vassilev

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

Reply via email to