Re: [RFC] PHP Attributes
| From: | Dmitry Stogov | Date: | Thu, 21 Apr 2016 23:19:46 +0000 |
| Subject: | Re: [RFC] PHP Attributes | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-92622@lists.php.net to get a copy of this message | ||
On 04/22/2016 02:02 AM, Ryan Pallas wrote:
On Thu, Apr 21, 2016 at 4:51 PM, Dmitry Stogov <dmitry@zend.com <mailto:dmitry@zend.com>> wrote:About expressions, isn't there an ambigoutiy? <<test(1)>> is a "plain" name, value based attribute. But it could also be an ast\node of a function call to "test(1)"even in AST scalars are scalars. so <<test(1+2)>> would return: ast\node "+" with two children int(1) and int(2).I am wondering if they shouldn't get their own start/end signs to clear that up, <<<test(1)>> vs <<test(1)>>.no need for extra complication.Since the encapsulated meta-data is an AST, and as you say any valid php expression will be valid here, what about bit shifting? <<Test(FOO >> BAR)>> This works because attributes are implemented as native part of context-free PHP grammar.
Are there concerns about finding the T_SR token, which is also the end annotation symbol? I've not done any work in the parser, so excuse me if that is an insanely stupid question :) Not a problem. Better to get false alarm then miss a real one :)
Otherwise, I think this RFC looks great, and appreciate your work on this :) Thanks. Dmitry.
Ryan