Re: Re: Trait aliasing syntax suggestions

From: Date: Fri, 22 Feb 2008 07:27:08 +0000
Subject: Re: Re: Trait aliasing syntax suggestions
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-35721@lists.php.net to get a copy of this message
On 22.02.2008, at 06:56, Gregory Beaver 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.
Not yet at any rate. From what I hear the next step after migration to re2c [1] is to migrate to lemon, which should make stuff like this possible. However while re2c has a chance of making it into PHP 5.3, the lemon part seems a bit further off. regards, Lukas [1] http://blog.somabo.de/2008/02/php-on-re2c.html

« previous php.internals (#35721) next »