Re: [PHP-DEV] Annotations in PHP7

2015-02-25 Thread Larry Garfield
On 2/25/15 5:45 AM, Peter Holák wrote: One thing to consider when annotations are classes is whether using an annotation should make the annotated class depend on the annotation classes it uses. In other words, would a missing annotation class produce an error? It doesn't in Java (at runtime,

Re: [PHP-DEV] Annotations in PHP7

2015-02-25 Thread Peter Holák
One thing to consider when annotations are classes is whether using an annotation should make the annotated class depend on the annotation classes it uses. In other words, would a missing annotation class produce an error? It doesn't in Java (at runtime, see http://stackoverflow.com/a/3567969) and

Re: [PHP-DEV] Annotations in PHP7

2015-02-24 Thread Larry Garfield
On 02/21/2015 03:35 PM, Pavel Kouřil wrote: I know you could wrap it in your code, but that would still mean there would probably be multiple implementations of Annotations in the wild, instead of a good complete functionality in the language itself. I know PHP is not primarily an OOP

Re: [PHP-DEV] Annotations in PHP7

2015-02-21 Thread Pavel Kouřil
On Wed, Feb 18, 2015 at 9:45 PM, Benjamin Eberlei kont...@beberlei.de wrote: On Wed, Feb 18, 2015 at 9:29 PM, Pavel Kouřil pajou...@gmail.com wrote: As a Doctrine user, I find this way worse than current state. This syntax looks UGLY and contains a lot of useless clutter. And yeah, adding

Re: [PHP-DEV] Annotations in PHP7

2015-02-20 Thread Crypto Compress
Am 19.02.2015 um 08:14 schrieb Dmitry Stogov: On Thu, Feb 19, 2015 at 2:12 AM, François Laupretre franc...@php.net mailto:franc...@php.net wrote: If I understand Dmitry correctly, this would be stored as the compiler internal representation of the 'new Entity(foo)' code, but this

Re: [PHP-DEV] Annotations in PHP7

2015-02-18 Thread Dmitry Stogov
On Wed, Feb 18, 2015 at 11:05 AM, Benjamin Eberlei kont...@beberlei.de wrote: On Wed, Feb 18, 2015 at 8:02 AM, Dmitry Stogov dmi...@zend.com wrote: On Wed, Feb 18, 2015 at 12:51 AM, guilhermebla...@gmail.com guilhermebla...@gmail.com wrote: François, Doctrine relies on nested

Re: [PHP-DEV] Annotations in PHP7

2015-02-18 Thread Benjamin Eberlei
On Wed, Feb 18, 2015 at 8:02 AM, Dmitry Stogov dmi...@zend.com wrote: On Wed, Feb 18, 2015 at 12:51 AM, guilhermebla...@gmail.com guilhermebla...@gmail.com wrote: François, Doctrine relies on nested annotations for a variety of mapping information. One example:

Re: [PHP-DEV] Annotations in PHP7

2015-02-18 Thread Dmitry Stogov
On Wed, Feb 18, 2015 at 11:59 AM, Derick Rethans der...@php.net wrote: On Tue, 17 Feb 2015, Dmitry Stogov wrote: On Mon, Feb 16, 2015 at 10:57 PM, Derick Rethans der...@php.net wrote: On Mon, 16 Feb 2015, Dmitry Stogov wrote: hi, During discussion of different ways of

Re: [PHP-DEV] Annotations in PHP7

2015-02-18 Thread Derick Rethans
On Tue, 17 Feb 2015, Dmitry Stogov wrote: On Mon, Feb 16, 2015 at 10:57 PM, Derick Rethans der...@php.net wrote: On Mon, 16 Feb 2015, Dmitry Stogov wrote: hi, During discussion of different ways of implementing Design by Contract we got an idea of using annotations.

Re: [PHP-DEV] Annotations in PHP7

2015-02-18 Thread Dmitry Stogov
On Wed, Feb 18, 2015 at 6:14 PM, François Laupretre franc...@php.net wrote: Hi Dmitry, Right. That’s what I got from your last reply. But my question was about another post where you are talking about ‘compile time evaluation’ of expressions, which is different from the bare key/value

Re: [PHP-DEV] Annotations in PHP7

2015-02-18 Thread guilhermebla...@gmail.com
Hi Dmitry, Are you (and Doctrine team) interested in this annotation idea? I'd say that Benjamin nailed in our possible usage: orm(new Entity(foo)) class Foo { } Now I do feel we need to elaborate some sort of named parameters. Doctrine tries to simplify a lot developer's life by using

Re: [PHP-DEV] Annotations in PHP7

2015-02-18 Thread Pavel Kouřil
On Wed, Feb 18, 2015 at 7:28 PM, guilhermebla...@gmail.com guilhermebla...@gmail.com wrote: Hi Dmitry, Are you (and Doctrine team) interested in this annotation idea? I'd say that Benjamin nailed in our possible usage: orm(new Entity(foo)) class Foo { } Now I do feel we need to

RE: [PHP-DEV] Annotations in PHP7

2015-02-18 Thread François Laupretre
Hi Guilherme, De : guilhermebla...@gmail.com [mailto:guilhermebla...@gmail.com] orm( [ new OneToOne(Address), new JoinColumn(default, default, default, default, CASCADE) ] ) public $address; Why not : orm([ 'OneToOne' = Address, 'JoinColumns' = [

Re: [PHP-DEV] Annotations in PHP7

2015-02-18 Thread Benjamin Eberlei
On Wed, Feb 18, 2015 at 9:40 PM, François Laupretre franc...@php.net wrote: Hi Guilherme, De : guilhermebla...@gmail.com [mailto:guilhermebla...@gmail.com] orm( [ new OneToOne(Address), new JoinColumn(default, default, default, default, CASCADE) ] )

Re: [PHP-DEV] Annotations in PHP7

2015-02-18 Thread Benjamin Eberlei
On Wed, Feb 18, 2015 at 9:29 PM, Pavel Kouřil pajou...@gmail.com wrote: On Wed, Feb 18, 2015 at 7:28 PM, guilhermebla...@gmail.com guilhermebla...@gmail.com wrote: Hi Dmitry, Are you (and Doctrine team) interested in this annotation idea? I'd say that Benjamin nailed in our possible

Re: [PHP-DEV] Annotations in PHP7

2015-02-18 Thread Crypto Compress
Hi List, orm(new Entity(foo)) this may be off-topic. However i'm wondering how this could be an annotation? It looks like code. Why not include this into proper method? What am i missing? -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit:

Re: [PHP-DEV] Annotations in PHP7

2015-02-18 Thread Dmitry Stogov
février 2015 23:11 À : PHP Developers Mailing List Objet : Re: [PHP-DEV] Annotations in PHP7 Hi List, orm(new Entity(foo)) this may be off-topic. However i'm wondering how this could be an annotation? It looks like code. Why not include this into proper method? What am i missing

RE: [PHP-DEV] Annotations in PHP7

2015-02-18 Thread François Laupretre
De : Benjamin Eberlei [mailto:kont...@beberlei.de] nested can be done in any way, its a statement so the following would work: orm(new JoinTable(['joinColumns' = [new JoinColumn('id', 'other_id')]])) Dmitry is planning compile time evaluation, which is probably the only way to do it if we

RE: [PHP-DEV] Annotations in PHP7

2015-02-18 Thread François Laupretre
Hi Dmitry, Right. That’s what I got from your last reply. But my question was about another post where you are talking about ‘compile time evaluation’ of expressions, which is different from the bare key/value storage I understood first, and poses the problem of compile time evaluation

RE: [PHP-DEV] Annotations in PHP7

2015-02-18 Thread François Laupretre
...@googlemail.com] Envoyé : mercredi 18 février 2015 23:11 À : PHP Developers Mailing List Objet : Re: [PHP-DEV] Annotations in PHP7 Hi List, orm(new Entity(foo)) this may be off-topic. However i'm wondering how this could be an annotation? It looks like code. Why not include

Re: [PHP-DEV] Annotations in PHP7

2015-02-17 Thread Dmitry Stogov
On Wed, Feb 18, 2015 at 12:51 AM, guilhermebla...@gmail.com guilhermebla...@gmail.com wrote: François, Doctrine relies on nested annotations for a variety of mapping information. One example:

Re: [PHP-DEV] Annotations in PHP7

2015-02-17 Thread Dmitry Stogov
On Tue, Feb 17, 2015 at 10:13 PM, Alexander Lisachenko lisachenko...@gmail.com wrote: 2015-02-17 19:25 GMT+03:00 Dmitry Stogov dmi...@zend.com: I think yes, However, Alexander thinks differently https://wiki.php.net/rfc/parser-extension-api Of course this is not for 7.0 This RFC

Re: [PHP-DEV] Annotations in PHP7

2015-02-17 Thread Dmitry Stogov
On Tue, Feb 17, 2015 at 5:06 PM, Nikita Popov nikita@gmail.com wrote: On Mon, Feb 16, 2015 at 10:15 PM, Dmitry Stogov dmi...@zend.com wrote: Hi Nikita, On Tue, Feb 17, 2015 at 12:07 AM, Nikita Popov nikita@gmail.com wrote: On Mon, Feb 16, 2015 at 10:02 PM, Dmitry Stogov

Re: [PHP-DEV] Annotations in PHP7

2015-02-17 Thread Nikita Popov
On Mon, Feb 16, 2015 at 10:15 PM, Dmitry Stogov dmi...@zend.com wrote: Hi Nikita, On Tue, Feb 17, 2015 at 12:07 AM, Nikita Popov nikita@gmail.com wrote: On Mon, Feb 16, 2015 at 10:02 PM, Dmitry Stogov dmi...@zend.com wrote: On Mon, Feb 16, 2015 at 11:05 PM, Benjamin Eberlei

Re: [PHP-DEV] Annotations in PHP7

2015-02-17 Thread Alexander Lisachenko
2015-02-17 19:25 GMT+03:00 Dmitry Stogov dmi...@zend.com: I think yes, However, Alexander thinks differently https://wiki.php.net/rfc/parser-extension-api Of course this is not for 7.0 This RFC consists of two parts: parsing API and parser extension API. Last one can be rejected, however it

RE: [PHP-DEV] Annotations in PHP7

2015-02-17 Thread François Laupretre
Hi Alexander, De : Alexander Lisachenko [mailto:lisachenko...@gmail.com] This RFC consists of two parts: parsing API and parser extension API. Last one can be rejected, however it can be perfectly connected with annotation RFC (if AST will be used as values) Parser extension API is great.

Re: [PHP-DEV] Annotations in PHP7

2015-02-17 Thread guilhermebla...@gmail.com
François, Doctrine relies on nested annotations for a variety of mapping information. One example: http://doctrine-orm.readthedocs.org/en/latest/reference/association-mapping.html#one-to-many-unidirectional-with-join-table []s, On Tue, Feb 17, 2015 at 4:33 PM, François Laupretre

Re: [PHP-DEV] Annotations in PHP7

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

Re: [PHP-DEV] Annotations in PHP7

2015-02-16 Thread Derick Rethans
On Mon, 16 Feb 2015, 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 proposed long time ago:

Re: [PHP-DEV] Annotations in PHP7

2015-02-16 Thread Pavel Kouřil
On Mon, Feb 16, 2015 at 1:33 PM, Benjamin Eberlei kont...@beberlei.de wrote: On Mon, Feb 16, 2015 at 1:17 PM, Pavel Kouřil pajou...@gmail.com wrote: On Mon, Feb 16, 2015 at 12:07 PM, Dmitry Stogov dmi...@zend.com wrote: hi, During discussion of different ways of implementing Design by

Re: [PHP-DEV] Annotations in PHP7

2015-02-16 Thread Dmitry Stogov
Hi Nikita, On Tue, Feb 17, 2015 at 12:07 AM, Nikita Popov nikita@gmail.com wrote: On Mon, Feb 16, 2015 at 10:02 PM, Dmitry Stogov dmi...@zend.com wrote: On Mon, Feb 16, 2015 at 11:05 PM, Benjamin Eberlei kont...@beberlei.de wrote: On Mon, Feb 16, 2015 at 12:07 PM, Dmitry Stogov

Re: [PHP-DEV] Annotations in PHP7

2015-02-16 Thread Benjamin Eberlei
On Mon, Feb 16, 2015 at 1:14 PM, Alexander Lisachenko lisachenko...@gmail.com wrote: 2015-02-16 15:12 GMT+03:00 Benjamin Eberlei kont...@beberlei.de: but what is the API of an AST node and how does the visitor look like? I have a draft for that:

Re: [PHP-DEV] Annotations in PHP7

2015-02-16 Thread Dmitry Stogov
We don't have final design yet. just idea(s) and a question - should we try to do it for PHP7 or later or not at all. Thanks. Dmitry. On Mon, Feb 16, 2015 at 3:43 PM, Cesar Rodas ce...@rodas.me wrote: On 16/02/15 13:40, Alexander Lisachenko wrote: 2015-02-16 15:31 GMT+03:00 Benjamin

Re: [PHP-DEV] Annotations in PHP7

2015-02-16 Thread Pavel Kouřil
On Mon, Feb 16, 2015 at 12:07 PM, Dmitry Stogov 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

Re: [PHP-DEV] Annotations in PHP7

2015-02-16 Thread Benjamin Eberlei
On Mon, Feb 16, 2015 at 1:17 PM, Pavel Kouřil pajou...@gmail.com wrote: On Mon, Feb 16, 2015 at 12:07 PM, Dmitry Stogov 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

Re: [PHP-DEV] Annotations in PHP7

2015-02-16 Thread Alexander Lisachenko
2015-02-16 15:31 GMT+03:00 Benjamin Eberlei kont...@beberlei.de: My question is how do i evaluate this at runtime? I suppose a function is necessary like evaluate_ast(...), but that requires passing the context. many many open questions and as nikic points out this should probably be

Re: [PHP-DEV] Annotations in PHP7

2015-02-16 Thread Cesar Rodas
On 16/02/15 14:00, Dmitry Stogov wrote: We don't have final design yet. just idea(s) and a question - should we try to do it for PHP7 or later or not at all. That is awesome. I would vote for a yes and I'd like it out ASAP (I would adapt my own annotation parser to read *also* this

Re: [PHP-DEV] Annotations in PHP7

2015-02-16 Thread Cesar Rodas
On 16/02/15 13:40, Alexander Lisachenko wrote: 2015-02-16 15:31 GMT+03:00 Benjamin Eberlei kont...@beberlei.de: My question is how do i evaluate this at runtime? I suppose a function is necessary like evaluate_ast(...), but that requires passing the context. many many open questions and as

Re: [PHP-DEV] Annotations in PHP7

2015-02-16 Thread Dmitry Stogov
our approach is more powerfull, and HHVM syntax is not sufficient. Also somethig looks better than something. anyway, syntax decorators are discussable. Thanks. Dmitry. On Mon, Feb 16, 2015 at 3:19 PM, Dennis Birkholz den...@birkholz.biz wrote: Hi, Am 16.02.2015 um 12:07 schrieb Dmitry

Re: [PHP-DEV] Annotations in PHP7

2015-02-16 Thread Alexander Lisachenko
2015-02-16 15:12 GMT+03:00 Benjamin Eberlei kont...@beberlei.de: but what is the API of an AST node and how does the visitor look like? I have a draft for that: https://gist.github.com/lisachenko/ffcfdec4c46e01864b33 This is extended version for php-ast extension that I want to propose for

Re: [PHP-DEV] Annotations in PHP7

2015-02-16 Thread Dennis Birkholz
Hi, Am 16.02.2015 um 12:07 schrieb Dmitry Stogov: HHVM already implemented similar concept http://docs.hhvm.com/manual/en/hack.attributes.php Why not borrow their syntax? Makes it easier to write stuff for both languages. Greets, Dennis -- PHP Internals - PHP Runtime Development Mailing

Re: [PHP-DEV] Annotations in PHP7

2015-02-16 Thread Dmitry Stogov
On Mon, Feb 16, 2015 at 10:57 PM, Derick Rethans der...@php.net wrote: On Mon, 16 Feb 2015, 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

Re: [PHP-DEV] Annotations in PHP7

2015-02-16 Thread Dmitry Stogov
On Mon, Feb 16, 2015 at 11:05 PM, Benjamin Eberlei kont...@beberlei.de wrote: On Mon, Feb 16, 2015 at 12:07 PM, Dmitry Stogov 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

Re: [PHP-DEV] Annotations in PHP7

2015-02-16 Thread Nikita Popov
On Mon, Feb 16, 2015 at 10:02 PM, Dmitry Stogov dmi...@zend.com wrote: On Mon, Feb 16, 2015 at 11:05 PM, Benjamin Eberlei kont...@beberlei.de wrote: On Mon, Feb 16, 2015 at 12:07 PM, Dmitry Stogov dmi...@zend.com wrote: hi, During discussion of different ways of implementing Design by

[PHP-DEV] Annotations in PHP7

2015-02-16 Thread Dmitry Stogov
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

Re: [PHP-DEV] Annotations in PHP7

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

Re: [PHP-DEV] Annotations in PHP7

2015-02-16 Thread Dmitry Stogov
the idea to not evaluate non-constant expressions at all, but just keep AST and provide interface to read it. PHP extensions should be able to use them as they like. (evaluate or insert into AST of function(s), etc). Thanks. Dmitry. On Mon, Feb 16, 2015 at 2:36 PM, Benjamin Eberlei

Re: [PHP-DEV] Annotations in PHP7

2015-02-16 Thread Benjamin Eberlei
On Mon, Feb 16, 2015 at 12:42 PM, Dmitry Stogov dmi...@zend.com wrote: the idea to not evaluate non-constant expressions at all, but just keep AST and provide interface to read it. PHP extensions should be able to use them as they like. (evaluate or insert into AST of function(s), etc). Ok

Re: [PHP-DEV] Annotations in PHP7

2015-02-16 Thread Dmitry Stogov
yeah, it was a typo, that I fixed in first place, but not in the output On Mon, Feb 16, 2015 at 2:49 PM, Benjamin Eberlei kont...@beberlei.de wrote: On Mon, Feb 16, 2015 at 12:42 PM, Dmitry Stogov dmi...@zend.com wrote: the idea to not evaluate non-constant expressions at all, but just keep

Re: [PHP-DEV] Annotations in PHP7

2015-02-16 Thread Alexander Lisachenko
2015-02-16 14:42 GMT+03:00 Dmitry Stogov dmi...@zend.com: the idea to not evaluate non-constant expressions at all, but just keep AST and provide interface to read it. PHP extensions should be able to use them as they like. (evaluate or insert into AST of function(s), etc). Thanks. Dmitry.

Re: [PHP-DEV] Annotations in PHP7

2015-02-16 Thread Benjamin Eberlei
On Mon, Feb 16, 2015 at 1:10 PM, Alexander Lisachenko lisachenko...@gmail.com wrote: 2015-02-16 14:42 GMT+03:00 Dmitry Stogov dmi...@zend.com: the idea to not evaluate non-constant expressions at all, but just keep AST and provide interface to read it. PHP extensions should be able to use