On 22/04/2016 08:17, Dmitry Stogov wrote:


On 04/22/2016 05:15 AM, Sara Golemon wrote:
On Thu, Apr 21, 2016 at 2:13 PM, Dmitry Stogov <dmi...@zend.com> wrote:
I would like to present an RFC proposing support for native annotation.

I'm trying to imagine where the benefit of non-constant expressions
comes in.

<<foo($a < 1)>>

Assuming we roll in php-ast at the same time (which is a big addition,
IMO, and deserves its own separate RFC), what are users meant to do
with this?  Even if there's a use-case here, one could accomplish the
same thing with:

<<foo('$a < 1')>>

And manually running that string into php-ast if that's what the
caller wanted.

Good point. It's really not a big deal to run
ast\parse_code($r->getAttributes()["foo"])
This would simplify the implementation a bit.

I can't speak for the implementation details, but I see a few benefits of having real AST vs a string.. You get syntax highlighting in editors, and most importantly compile time syntax errors if you messed up.

Cheers

--
Jordi Boggiano
@seldaek - http://seld.be

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

Reply via email to