phpdoc is annotation as well, but to split it into specific attributes we have to write specialized parsers. Other languages support annotation or attributes that may be used more easily.
http://docs.hhvm.com/manual/en/hack.attributes.php Thanks. Dmitry. On Thu, Feb 5, 2015 at 6:40 PM, François Laupretre <franc...@tekwire.net> wrote: > De : Pierre Joye [mailto:pierre....@gmail.com] > > >> Yes, it makes phpdoc more tied to the engine but is it a problem ? > > > > And here I have to jump in and say: don't. > > And remind about one of the exact purposes of annotations. > > Sorry, I am not sure I understand. > > If you're talking about the link between the engine and phpdoc comments, I > agree. It is not a job for the PHP engine. It is a job for a script > pre-processor, contained in an extension, and called BEFORE the file starts > to be parsed by the engine, not after the AST is generated. It is very easy > to pre-process PHP scripts and insert PHP code for DbC checks, while doing > the same using an AST and generated opcodes looks much harder to me. > > As I told Alexander, in my opinion, phpdoc blocks already provide a lot of > useful DbC information. My objective is to extend the syntax to support > more complex directives, which are still legitimate phpdoc information. I > see both concepts as closely related. One is generating documentation, one > is generating runtime checks, but both use the same information. > > About annotations, I don't know much about it, as I was naively thinking > that phpdoc '@' directives were annotations, but I understand I was > probably wrong. The only concern I have about introducing a new annotation > syntax is BC break. > > Cheers > > François > >