Re: [PHP-DEV] Re: Annotations in PHP7

2015-02-17 Thread Dmitry Stogov
On Tue, Feb 17, 2015 at 4:50 PM, François Laupretre wrote: > HI Dmitry, > > Question : in which scope do you evaluate the PHP expression ? > We don't evaluate expressions. We just store them. Evaluation and/or modification is a subject for future development. > > Example : > > 0);> > 0);> >

RE: [PHP-DEV] Re: Annotations in PHP7

2015-02-17 Thread François Laupretre
HI Dmitry, Question : in which scope do you evaluate the PHP expression ? Example : 0);> 0);> function foo($a) { ... How can you know from this that the first expression must be evaluated at function entry, that the second one must be interpreted when function exits, let alone the question

Re: [PHP-DEV] Re: Annotations in PHP7

2015-02-16 Thread Dmitry Stogov
On Tue, Feb 17, 2015 at 6:45 AM, François Laupretre wrote: > Hi Dmitry, > > In my mind, annotation syntax was one level lower, dealing with strings of > unknown syntax, not PHP expressions. Something like : > > '*' '@' STRING free-string-up-to-eol > > This supports : > > * @requires $a > 0 > Th

RE: [PHP-DEV] Re: Annotations in PHP7

2015-02-16 Thread François Laupretre
Hi Dmitry, In my mind, annotation syntax was one level lower, dealing with strings of unknown syntax, not PHP expressions. Something like : '*' '@' STRING free-string-up-to-eol This supports : * @requires $a > 0 But also : * @statement INSERT INTO ?? VALUES (13, 'Phoenix', 'AZ', 33, 112) U

[PHP-DEV] Re: Annotations in PHP7

2015-02-16 Thread Yasuo Ohgaki
Hi Dmitry, On Mon, Feb 16, 2015 at 8:07 PM, Dmitry Stogov wrote: > 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 pr

[PHP-DEV] Re: Annotations in PHP7

2015-02-16 Thread Dmitry Stogov
On Tue, Feb 17, 2015 at 1:15 AM, Yasuo Ohgaki wrote: > Hi Dmitry, > > On Mon, Feb 16, 2015 at 8:07 PM, Dmitry Stogov wrote: > >> 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

[PHP-DEV] Re: Annotations in PHP7

2015-02-16 Thread Yasuo Ohgaki
Hi Dmitry, On Mon, Feb 16, 2015 at 8:07 PM, Dmitry Stogov wrote: > 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 pr

Re: [PHP-DEV] Re: Annotations in PHP7

2015-02-16 Thread Rafael Dohms
On Mon, Feb 16, 2015 at 7:41 PM, Dmitry Stogov wrote: > this won't implement features necessary for phpDocumentor, Doctrine, etc. > Just be careful here with phpDocumentor, it does not use annotations but really needs docblocks instead. Today the overlap between it and doctrine and such is just

Re: [PHP-DEV] Re: Annotations in PHP7

2015-02-16 Thread Rowan Collins
Dmitry Stogov wrote on 16/02/2015 18:41: this won't implement features necessary for phpDocumentor, Doctrine, etc. I know. Like I say, it's just a way of keeping things moving, rather than saying "eh, maybe next year". It allows us to formally agree the feature, the roadmap, the basic synt

[PHP-DEV] Re: Annotations in PHP7

2015-02-16 Thread Dmitry Stogov
On Mon, Feb 16, 2015 at 8:41 PM, Stanislav Malyshev wrote: > Hi! > > > 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. > > Looks fine, but

Re: [PHP-DEV] Re: Annotations in PHP7

2015-02-16 Thread Dmitry Stogov
this won't implement features necessary for phpDocumentor, Doctrine, etc. On Mon, Feb 16, 2015 at 8:29 PM, Rowan Collins wrote: > On Mon, Feb 16, 2015 at 6:41 PM, Rowan Collins > wrote: > >Is there any value in deciding the initial syntax for 7.0, and >i

[PHP-DEV] Re: Annotations in PHP7

2015-02-16 Thread Stanislav Malyshev
Hi! > 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. Looks fine, but I'm not sure how one can use the AST that the reflection returns. Is it f

Re: [PHP-DEV] Re: Annotations in PHP7

2015-02-16 Thread Rowan Collins
On Mon, Feb 16, 2015 at 6:41 PM, Rowan Collins > wrote: Is there any value in deciding the initial syntax for 7.0, and implementing only non-parameterised annotations, i.e. you can call hasAnnotation(string): bool but nothing else? Dmitry Stogov wrote on

Re: [PHP-DEV] Re: Annotations in PHP7

2015-02-16 Thread Dmitry Stogov
this will work, of course, and robust implementation wouldn't take more than a day :) but it'll require user-level parser again. no big advantage in comparison to doc-block. Thanks. Dmitry. On Mon, Feb 16, 2015 at 6:41 PM, Rowan Collins wrote: > Nikita Popov wrote on 16/02/2015 12:14: > >> I

Re: [PHP-DEV] Re: Annotations in PHP7

2015-02-16 Thread Rowan Collins
Nikita Popov wrote on 16/02/2015 12:14: I think this is a great idea, but we should postpone it to PHP 7.1. Especially if you want to make this AST based (which would require both stabilizing the AST we return for expressions and having APIs to do codegen based on the AST) it will require a lot o

[PHP-DEV] Re: Annotations in PHP7

2015-02-16 Thread Pierre Joye
On Mon, Feb 16, 2015 at 3:07 AM, Dmitry Stogov wrote: > hi, > > During discussion of different ways of implementing "Design by Contract" we > got an idea of using annotations. Thanks a lot to push that forward! > BTW: annotations are useful by their own and may be used for different > purposes.

[PHP-DEV] Re: Annotations in PHP7

2015-02-16 Thread Dmitry Stogov
The implementation is not going to be simple, and taking in account other tasks, it may be difficult to provide high-quality implementation. Lets look if it's really a desirable feature. Then I may do all my best, or forget about it by 7.1. Thanks. Dmitry. On Mon, Feb 16, 2015 at 3:14 PM, Nikita

[PHP-DEV] Re: Annotations in PHP7

2015-02-16 Thread Nikita Popov
On Mon, Feb 16, 2015 at 12:07 PM, Dmitry Stogov 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 propo

[PHP-DEV] Re: Annotations in PHP7

2015-02-16 Thread Alexander Lisachenko
2015-02-16 14:19 GMT+03:00 Dmitry Stogov : > annotations ::= { annotation }. > annotation ::= '<' STRING '>' | '<' STRING '(' expr ')' '>'. > > where is regular PHP expression. Hello! Really like this syntax, actually you steal my thoughts )) I want to call this metadata, not an annotations

Re: [PHP-DEV] Re: Annotations in PHP7

2015-02-16 Thread Cesar Rodas
On 16/02/15 12:36, Dmitry Stogov wrote: > yes. like it was proposed at > https://wiki.php.net/rfc/reflection_doccomment_annotations#list_of_methods_to_implement Awesome. I would +1 for sure! Cheers, > > Thanks. Dmitry. > > On Mon, Feb 16, 2015 at 2:34 PM, Cesar Rodas > w

Re: [PHP-DEV] Re: Annotations in PHP7

2015-02-16 Thread Dmitry Stogov
yes. like it was proposed at https://wiki.php.net/rfc/reflection_doccomment_annotations#list_of_methods_to_implement Thanks. Dmitry. On Mon, Feb 16, 2015 at 2:34 PM, Cesar Rodas wrote: > > On 16/02/15 12:32, Dmitry Stogov wrote: > > you already have doc-block. nothing should be done in PHP cor

Re: [PHP-DEV] Re: Annotations in PHP7

2015-02-16 Thread Cesar Rodas
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. A

Re: [PHP-DEV] Re: Annotations in PHP7

2015-02-16 Thread Dmitry Stogov
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. Thanks. Dmitry. On Mon, Feb 16, 2015 at 2:22 PM, Ce

Re: [PHP-DEV] Re: Annotations in PHP7

2015-02-16 Thread Cesar Rodas
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 is regular PHP expression. Why not doc-block annotati

[PHP-DEV] Re: Annotations in PHP7

2015-02-16 Thread Dmitry Stogov
I decided to explain the proposed annotation syntax "in words" to avoid misunderstanding annotations ::= { annotation }. annotation ::= '<' STRING '>' | '<' STRING '(' expr ')' '>'. where is regular PHP expression. Thanks. Dmitry. On Mon, Feb 16, 2015 at 2:07 PM, Dmitry Stogov wrote: > hi