Gregory Beaver schrieb:
Christian Schneider wrote:
Another detail: The implementation of the parser changes should still
allow a class or function called "trait", i.e. "trait" should only be a
keyword at specific positions in the source to avoid unneccesary BC
breaks. The current patch has this BC problem.

This is not possible to implement, having tried to do a similar thing
for 'import' and 'namespace.'  The reason is that we can encounter a
classname at any point thanks to "classname::whatever" syntax, so it
slows the lexer down a bit in that for every T_TRAIT we would have to
check to see if the next 2 characters are ::, and makes the lexer
uber-complicated.  It's a big mess.

I think this is a point we should take seriously. I see the following solutions: 1. Wait with the introduction until either the parser allows such an addition without BC break or wait for the appropriate PHP release. (Is 5.3 the time to introduce this BC break? I don't know the current PHP definitions about major/minor releases) 2. Consider this issue carefully when deciding on a syntax. Maybe favour a syntax with fewer new keywords. Reusing keywords like "include", "as" or "not" come to mind.

- Chris

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

Reply via email to