On Wed, 2013-09-11 at 23:21 +0200, Bob Weinand wrote: > Hi! > > I tried to widen the naming possibilities by allowing to use keywords > as identifiers (for function names, class names, label (goto) > names, ...) where possible. It doesn't break any BC.
I often stumbled over the annoyance of this limitation and I know many users want it, I'm not convinced about adding it, though. One reason is the "where (easily) possible" part. Right now we have a simple rule "keywords can't be reused". This is being changed to "this and that keyword can be used her and there." I don't believe this is good. Secondly I'm among the people who read tons of "bad" code and I'm sure people will abuse this and we will find code like this: <?php namespace network; function if($which) { // ... some logic ... return "eth0"; } // ... somewhere else in the namespace ... if($condition); ?> This can hide subtile typos or coding errors. Also look at currently valid PHP code like this: <?php function while() {} $condition = true; while ($condition) ?> and while reading this mind that an ; in front of an ?> is optional, so will this call a function and exit or be stuck in an infinite loop? I'm sure one could construct other such cases. I'm more open about allowing such identifiers as method names only, as those are prefixed in some way ($object-> or someClass:: ) but even there I tend to consider the consistency between function and method names more important than this flexibility. I couldn't test those examples as your branch for some reason didn't work, even though I made sure I regenerated the parser, but I didn't look deeper, maybe my fault. 001+ Parse error: syntax error, unexpected 'catch' (T_CATCH), expecting identifier (T_STRING) or \\ (T_NS_SEPARATOR) or '{' in /.../Zend/tests/identifier_or_keyword_001.php on line 3 001- Ok 002- Fatal error: %s in %s on line %d johannes -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php