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, see

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 languag

Re: [PHP-DEV] Annotations in PHP7

2015-02-21 Thread Pavel Kouřil
On Wed, Feb 18, 2015 at 9:45 PM, Benjamin Eberlei wrote: > > > On Wed, Feb 18, 2015 at 9:29 PM, Pavel Kouřil 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 named parameters to PHP be p

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 > wrote: If I understand Dmitry correctly, this would be stored as the compiler internal representation of the 'new Entity("foo")' code, but this wouldn't be exe

Re: [PHP-DEV] Annotations in PHP7

2015-02-18 Thread Dmitry Stogov
igine- > > De : Crypto Compress [mailto:cryptocompr...@googlemail.com] > > Envoyé : mercredi 18 février 2015 23:11 > > À : PHP Developers Mailing List > > Objet : Re: [PHP-DEV] Annotations in PHP7 > > > > Hi List, > > > > > > > > &g

RE: [PHP-DEV] Annotations in PHP7

2015-02-18 Thread François Laupretre
d'origine- > De : Crypto Compress [mailto:cryptocompr...@googlemail.com] > Envoyé : mercredi 18 février 2015 23:11 > À : PHP Developers Mailing List > Objet : Re: [PHP-DEV] Annotations in PHP7 > > Hi List, > > > > > this may be off-topic. However i'm wondering

Re: [PHP-DEV] Annotations in PHP7

2015-02-18 Thread Crypto Compress
Hi List, 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: http://www.php.net/unsub.php

Re: [PHP-DEV] Annotations in PHP7

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

Re: [PHP-DEV] Annotations in PHP7

2015-02-18 Thread Benjamin Eberlei
On Wed, Feb 18, 2015 at 9:29 PM, Pavel Kouřil wrote: > On Wed, Feb 18, 2015 at 7:28 PM, 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: > > > > > > class Foo {

RE: [PHP-DEV] Annotations in PHP7

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

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 wrote: > Hi Dmitry, > >> Are you (and Doctrine team) interested in this annotation idea? > > I'd say that Benjamin nailed in our possible usage: > > > class Foo { > } > > Now I do feel we need to elaborate some sort of named parameters. D

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: 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 consistency in default map

Re: [PHP-DEV] Annotations in PHP7

2015-02-18 Thread Dmitry Stogov
On Wed, Feb 18, 2015 at 6:14 PM, François Laupretre 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 storage I > un

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 scope

Re: [PHP-DEV] Annotations in PHP7

2015-02-18 Thread Dmitry Stogov
On Wed, Feb 18, 2015 at 3:01 PM, François Laupretre wrote: > > De : Benjamin Eberlei [mailto:kont...@beberlei.de] > > > > nested can be done in any way, its a statement so the following would > work: > > > > [new JoinColumn('id', > 'other_id')]]))> > > Dmitry is planning compile time evaluation,

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: > > [new JoinColumn('id', 'other_id')]]))> Dmitry is planning compile time evaluation, which is probably the only way to do it if we use PHP expressions. Is class

RE: [PHP-DEV] Annotations in PHP7

2015-02-18 Thread François Laupretre
Hi Dmitry, > De : Dmitry Stogov [mailto:dmi...@zend.com] > Nested annotations are not going to be necessary, because they may be > represented by PHP pseudo-syntax (and/or PHP array syntax) > > ManyToMany($targetEntity="Phonenumber"), > JoinTable($name="users_phonenumbers", > $jo

Re: [PHP-DEV] Annotations in PHP7

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

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 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 11:05 AM, Benjamin Eberlei wrote: > > > On Wed, Feb 18, 2015 at 8:02 AM, Dmitry Stogov 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

Re: [PHP-DEV] Annotations in PHP7

2015-02-18 Thread Benjamin Eberlei
On Wed, Feb 18, 2015 at 8:02 AM, Dmitry Stogov 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: >> >> >> http://doctrin

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: > > > http://doctrine-orm.readthedocs.org/en/latest/reference/association-mapping.html#one-to-m

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 : > >> 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 consi

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 wrote: > Hi A

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 grea

Re: [PHP-DEV] Annotations in PHP7

2015-02-17 Thread Alexander Lisachenko
2015-02-17 19:25 GMT+03:00 Dmitry Stogov : > 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 can be per

Re: [PHP-DEV] Annotations in PHP7

2015-02-17 Thread Dmitry Stogov
On Tue, Feb 17, 2015 at 5:06 PM, Nikita Popov wrote: > On Mon, Feb 16, 2015 at 10:15 PM, Dmitry Stogov wrote: > >> Hi Nikita, >> >> On Tue, Feb 17, 2015 at 12:07 AM, Nikita Popov >> wrote: >> >>> On Mon, Feb 16, 2015 at 10:02 PM, Dmitry Stogov wrote: >>> On Mon, Feb 16, 2015 at

Re: [PHP-DEV] Annotations in PHP7

2015-02-17 Thread Nikita Popov
On Mon, Feb 16, 2015 at 10:15 PM, Dmitry Stogov wrote: > Hi Nikita, > > On Tue, Feb 17, 2015 at 12:07 AM, Nikita Popov > wrote: > >> On Mon, Feb 16, 2015 at 10:02 PM, Dmitry Stogov wrote: >> >>> >>> >>> On Mon, Feb 16, 2015 at 11:05 PM, Benjamin Eberlei >>> wrote: >>> On Mon, Fe

Re: [PHP-DEV] Annotations in PHP7

2015-02-16 Thread Nikita Popov
On Mon, Feb 16, 2015 at 10:02 PM, Dmitry Stogov wrote: > > > On Mon, Feb 16, 2015 at 11:05 PM, Benjamin Eberlei > wrote: > >> >> >> 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 a

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 wrote: > On Mon, Feb 16, 2015 at 10:02 PM, Dmitry Stogov wrote: > >> >> >> On Mon, Feb 16, 2015 at 11:05 PM, Benjamin Eberlei >> wrote: >> >>> >>> >>> On Mon, Feb 16, 2015 at 12:07 PM, Dmitry Stogov wrote: >>> hi, During

Re: [PHP-DEV] Annotations in PHP7

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

Re: [PHP-DEV] Annotations in PHP7

2015-02-16 Thread Dmitry Stogov
On Mon, Feb 16, 2015 at 10:57 PM, Derick Rethans 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 use

Re: [PHP-DEV] Annotations in PHP7

2015-02-16 Thread Benjamin Eberlei
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

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 tim

Re: [PHP-DEV] Annotations in PHP7

2015-02-16 Thread Pavel Kouřil
On Mon, Feb 16, 2015 at 1:33 PM, Benjamin Eberlei wrote: > > > On Mon, Feb 16, 2015 at 1:17 PM, Pavel Kouřil wrote: >> >> 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

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 annotation

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 wrote: > > On 16/02/15 13:40, Alexander Lisachenko wrote: > > 2015-02-16 15:31 GMT+03:00 Benjamin Eberlei : > > >

Re: [PHP-DEV] Annotations in PHP7

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

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 : > >> 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

Re: [PHP-DEV] Annotations in PHP7

2015-02-16 Thread Alexander Lisachenko
2015-02-16 15:31 GMT+03:00 Benjamin Eberlei : > > 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 > delayed to 7.1 becaus

Re: [PHP-DEV] Annotations in PHP7

2015-02-16 Thread Benjamin Eberlei
On Mon, Feb 16, 2015 at 1:17 PM, Pavel Kouřil wrote: > 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 m

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 : > >> 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/ffcfdec4c46e01

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 Pavel Kouřil
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 propos

Re: [PHP-DEV] Annotations in PHP7

2015-02-16 Thread Alexander Lisachenko
2015-02-16 15:12 GMT+03:00 Benjamin Eberlei : > 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 PHP.

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 : > >> 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

Re: [PHP-DEV] Annotations in PHP7

2015-02-16 Thread Alexander Lisachenko
2015-02-16 14:42 GMT+03:00 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. It's a

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 wrote: > > > On Mon, Feb 16, 2015 at 12:42 PM, Dmitry Stogov wrote: > >> the idea to not evaluate non-constant expressions at all, but just keep >> AST and provide interface

Re: [PHP-DEV] Annotations in PHP7

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

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 wrote: > > >

Re: [PHP-DEV] Annotations in PHP7

2015-02-16 Thread Benjamin Eberlei
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] 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 https://wiki