On 16/02/15 12:32, Dmitry Stogov wrote: > you already have doc-block. nothing should be done in PHP core, but > you have to parse it yourself. > The goal of annotations is to provide standard and powerful way. > On the other hand standard PHP expression syntax may be not enough for > all cases.
Agreed on that. I just thought it could be wise parse natively what is already out there. Anyways adapt our DocBlock annotation parsers to parse both (native PHP annotations and docblocks) shouldn't be that hard either. As far as I see annotations are supposed to be accessed through reflections right? Or will it do something automatically as in Python? Cheers, > > Thanks. Dmitry. > > On Mon, Feb 16, 2015 at 2:22 PM, Cesar Rodas <ce...@rodas.me > <mailto:ce...@rodas.me>> wrote: > > > On 16/02/15 12:19, Dmitry Stogov wrote: > > I decided to explain the proposed annotation syntax "in words" > to avoid > > misunderstanding > > > > annotations ::= { annotation }. > > annotation ::= '<' STRING '>' | '<' STRING '(' expr ')' '>'. > > > > where <expr> is regular PHP expression. > Why not doc-block annotations? So it can be parse/understand that is > already there (Doctrine annotations for instance). > > > > > Thanks. Dmitry. > > > > > > On Mon, Feb 16, 2015 at 2:07 PM, Dmitry Stogov <dmi...@zend.com > <mailto:dmi...@zend.com>> wrote: > > > >> hi, > >> > >> During discussion of different ways of implementing "Design by > Contract" > >> we got an idea of using annotations. > >> > >> BTW: annotations are useful by their own and may be used for > different > >> purposes. Support for annotations was proposed long time ago: > >> > >> https://wiki.php.net/rfc/annotations > >> https://wiki.php.net/rfc/annotations-in-docblock > >> https://wiki.php.net/rfc/reflection_doccomment_annotations > >> > >> HHVM already implemented similar concept > >> > >> http://docs.hhvm.com/manual/en/hack.attributes.php > >> > >> I made a quick and dirty PoC that shows how we may implement > annotations > >> in PHP7 and how powerful they may be : > >> https://gist.github.com/dstogov/dbf2a8f46e43719bd2c2 > >> > >> The test there is self explainable. Of course, annotations just > provide a > >> way to add metadata, but doesn't define attribute names or the > ways they > >> are going to be used. Only Reflection API to read. > >> > >> There are still a lot of technical problems that have to be solved. > >> Right now, we just need to answer a question - if we like this > in PHP7? > >> Thought and opinions are welcome... > >> > >> Thanks. Dmitry. > >> > > -- > César D. Rodas > Open Source developer > +595-983-161124 > PGP: F9ED A265 A3AB C8A1 D145 7368 158A 0336 C707 0AA6 > > > -- César D. Rodas Open Source developer +595-983-161124 PGP: F9ED A265 A3AB C8A1 D145 7368 158A 0336 C707 0AA6
signature.asc
Description: OpenPGP digital signature