On 04/24/2016 12:34 AM, Yasuo Ohgaki wrote:
Hi Dimitry,

On Fri, Apr 22, 2016 at 6:13 AM, Dmitry Stogov <dmi...@zend.com> wrote:
I would like to present an RFC proposing support for native annotation.

The naming, syntax and behavior are mostly influenced by HHVM Hack, but not 
exactly the same.

The most interesting difference is an ability to use arbitrary PHP expressions 
as attribute values.

These expressions are not evaluated, but stored as Abstract Syntax Trees, and later may 
be accessed (node by node) in PHP extensions, preprocessors and PHP scripts their selves. 
I think this ability may be useful for "Design By Contract", other formal 
verification systems, Aspect Oriented Programming, etc


https://wiki.php.net/rfc/attributes


Note that this approach is going to be native, in contrast to doc-comment 
approach that uses not well defined syntax, and even not parsed by PHP itself.


Additional ideas, endorsement and criticism are welcome.
Nice RFC!
Attributes are always evaluated, right? i.e. No INI switch nor declare
to control behavior.
Just making sure.
Attributes are always parsed together with PHP script and stored internally.
Then you may access them through Reflection*::getAttributes() or in C extensions through native API.

AST in attribute values is not evaluated.

Thanks. Dmitry.


Regards,

--
Yasuo Ohgaki
yohg...@ohgaki.net


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

Reply via email to