Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82822 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 86981 invoked from network); 16 Feb 2015 11:40:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Feb 2015 11:40:52 -0000 Authentication-Results: pb1.pair.com header.from=cesar@rodas.me; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=cesar@rodas.me; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain rodas.me designates 109.74.200.116 as permitted sender) X-PHP-List-Original-Sender: cesar@rodas.me X-Host-Fingerprint: 109.74.200.116 li147-116.members.linode.com Received: from [109.74.200.116] ([109.74.200.116:35957] helo=li147-116.members.linode.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D8/12-05176-347D1E45 for ; Mon, 16 Feb 2015 06:40:51 -0500 Message-ID: <54E1D72A.70301@rodas.me> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rodas.me; s=mail; t=1424086847; bh=nHIssl+b3H8T8wGdLNhKemACIaEccjShl3dNKdzRIl4=; h=Date:From:To:CC:Subject:References:In-Reply-To:From; b=K0WcNNhadQbmyhdJpiZH3SzPfA7QZrqaw10hUQEetY/dbtXvNJxVBLemf9bIAkrFW o5GTxk/PjRRjDanJnGrPnR7NJwX4Y6dzxb0LYJyief4mDX2t9jmWerF/sNpj72HdTK 9hAVoWLz4mF+Pb2SPG1S/RUAVGyA/FASXOXGTSbw= Date: Mon, 16 Feb 2015 12:40:26 +0100 MIME-Version: 1.0 To: Dmitry Stogov CC: PHP Internals References: <54E1D2F8.30606@rodas.me> <54E1D5DF.3050309@rodas.me> In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="fMao2ENI9mwWocn1wVU94xOx52xwaVErN" Subject: Re: [PHP-DEV] Re: Annotations in PHP7 From: cesar@rodas.me (Cesar Rodas) --fMao2ENI9mwWocn1wVU94xOx52xwaVErN Content-Type: multipart/alternative; boundary="------------070806070302050705010302" This is a multi-part message in MIME format. --------------070806070302050705010302 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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_meth= ods_to_implement Awesome. I would +1 for sure! Cheers, > > 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 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 Pyth= on? > > Cheers, > > >> >> Thanks. Dmitry. >> >> On Mon, Feb 16, 2015 at 2:22 PM, Cesar Rodas > > wrote: >> >> >> On 16/02/15 12:19, Dmitry Stogov wrote: >> > I decided to explain the proposed annotation syntax "in >> words" to avoid >> > misunderstanding >> > >> > annotations ::=3D { annotation }. >> > annotation ::=3D '<' STRING '>' | '<' STRING '(' expr ')' = '>'. >> > >> > where 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 >> > 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 ag= o: >> >> >> >> 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=C3=A9sar D. Rodas >> Open Source developer >> +595-983-161124 >> PGP: F9ED A265 A3AB C8A1 D145 7368 158A 0336 C707 0AA6 >> >> >> > > --=20 > C=C3=A9sar D. Rodas > Open Source developer > +595-983-161124 > PGP: F9ED A265 A3AB C8A1 D145 7368 158A 0336 C707 0AA6 > > --=20 C=C3=A9sar D. Rodas Open Source developer +595-983-161124 PGP: F9ED A265 A3AB C8A1 D145 7368 158A 0336 C707 0AA6 --------------070806070302050705010302 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
On 16/02/15 12:36, Dmitry Stogov wrote= :

Awesome. I would +1 for sure!

Cheers,


Thanks. Dmitry.

On Mon, Feb 16, 2015 at 2:34 PM, Cesar= Rodas <cesar@roda= s.me> wrote:
<= br>
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 <cesar@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 ::=3D { annotation }.
> annotation=C2=A0 =C2=A0::=3D '<' STRI= NG '>' | '<' 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 <dmitry@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/rf= c/annotations
>> https://wiki.php.net/rf= c/annotations-in-docblock
>> https://wiki.php.net/rf= c/reflection_doccomment_annotations
>>
>> HHVM already implemented similar concept
>>
>> http://docs.hhvm.com/ma= nual/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.<= br> >> Right now, we just need to answer a question - if we like this in PHP7?
>> Thought and opinions are welcome...
>>
>> Thanks. Dmitry.
>>

--
C=C3=A9sar D. Rodas
Open Source developer
+595-983-161124
PGP: F9ED A265 A3AB C8A1 D145 7368 158A 0336 C707 0AA6




--=20
C=C3=A9sar D. Rodas
Open Source developer
+595-983-161124
PGP: F9ED A265 A3AB C8A1 D145 7368 158A 0336 C707 0AA6


--=20
C=C3=A9sar D. Rodas
Open Source developer
+595-983-161124
PGP: F9ED A265 A3AB C8A1 D145 7368 158A 0336 C707 0AA6
--------------070806070302050705010302-- --fMao2ENI9mwWocn1wVU94xOx52xwaVErN Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJU4dcqAAoJEBWKAzbHBwqmArkQAJKGuPsehp7ueyXoszNaVY2f /8goT8bDTWOFTN7XZzmnEmrIhZIJAvSJjTzQ1MSbXgYmoNvf0GmE+vii+gmCvzry scQRkFABzLBM+XI6ZgIoGUZujAw3pdOJOQtqg9UhHvKOEXhbAqGFzPvtDIgJOv3A 9ksEiGNG1ly5aL0Pf1waS3iglUpgfzERo68Df4kS7ea/Zn6+hvndVHX8ZEzcQ96R bbKB9QNaCQW1tn9/ESdXHoHR+7vUbFxAIcnuNiqy3CLBrpQ7utkCyvHZSSYpCJyc TNiz61NetReRsetQv3vBZJ1+UXcuDTqxsTMUr2FMBt2Q7RUtsyNbCch4zEk/J2m+ 6j9oNuNXM5t8OLavGxsIb9QZuS/zqvpXnA8Lr0ARC/1geLtpmFk8/rrQ45nSerJg Vs2w1n/1i0ZUyLT79aDivo7FttnepdiGr8/o+B/+NK4by3FoSRwdF+U96I7j09iD wyLDbAWvwzExU/mzf6J9Wd/Cdi6CqHTB6/3GlTIbQ/mJMIKDzMbgm8+vbXKWGWHW ulnB42pas9BDGu5H6cXJ29JIshMIkrPTDsqzs0pbOF5+0GpfN+0O9MjJW8TY+Dks V6rZrDkjbpf/CH9mUnty5jviWWrWj+nbzHw9j4Ad5HQ0klpPL7ScPdZg+zprh6O3 N7di55wdnH95NTwIqEUZ =Y74T -----END PGP SIGNATURE----- --fMao2ENI9mwWocn1wVU94xOx52xwaVErN--