Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82821 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84059 invoked from network); 16 Feb 2015 11:37:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Feb 2015 11:37:06 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.178 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.178 mail-vc0-f178.google.com Received: from [209.85.220.178] ([209.85.220.178:42239] helo=mail-vc0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 90/71-05176-F56D1E45 for ; Mon, 16 Feb 2015 06:37:04 -0500 Received: by mail-vc0-f178.google.com with SMTP id hq11so10339403vcb.9 for ; Mon, 16 Feb 2015 03:36:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=kEhjj0JrHMdmGMZyUwyQya4wq82+T3z7OkRqAzsR1Ts=; b=G9iYhMEWSITGu5C3iTMIfkumkxbFGkP14nQdLS2F9CTwnOVkINNvYin/jg9hQp0wEe VA9lwFGsNRGBb+RMVv4KHwy1nkNmi3hQE5qzw6S8ch74Lwa64ocknH2rJNGMXm5HmKGQ +LXqt0HVdLdho+TwGURe81KwtLtBDjVp+k1Vg6Q/qrCAfhPzQ/Ke92wg8AQws8YYHcwt T9Kw0ENrtgj9lglxvohalW4tRFyXVeaB2Zl3SCMwiIVAqxyTM2fOn/aZ79a46tTWWnj2 jZvdsBmx6ZXuH2s5z3RQ+MzMs4AyC0GTxaaf/NDp2+QeVl+2g/QaHSz87IyEzDQqxX0W C0UQ== X-Gm-Message-State: ALoCoQlGaeEx6jpbGOLXAwwutLnE34VQSOI1e7EQwlDqm/hRDVAmDXDm0yimWWnDzB49Lsrl1+cBbRuN1MAQKCZ5HOC3hgiuZjsl1k3z/YKaMigYdsFnk8Zatvd2r2Me/x4C4E1qQv7bKJT39trWQiYOCdueebArxA== MIME-Version: 1.0 X-Received: by 10.220.110.205 with SMTP id o13mr2221765vcp.53.1424086619153; Mon, 16 Feb 2015 03:36:59 -0800 (PST) Received: by 10.52.74.73 with HTTP; Mon, 16 Feb 2015 03:36:59 -0800 (PST) In-Reply-To: <54E1D5DF.3050309@rodas.me> References: <54E1D2F8.30606@rodas.me> <54E1D5DF.3050309@rodas.me> Date: Mon, 16 Feb 2015 15:36:59 +0400 Message-ID: To: Cesar Rodas Cc: PHP Internals Content-Type: multipart/alternative; boundary=047d7b3a8cd010706c050f330142 Subject: Re: [PHP-DEV] Re: Annotations in PHP7 From: dmitry@zend.com (Dmitry Stogov) --047d7b3a8cd010706c050f330142 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 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 wrote: > >> >> On 16/02/15 12:19, Dmitry Stogov wrote: >> > I decided to explain the proposed annotation syntax "in words" to avoi= d >> > 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 differen= t >> >> 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 PHP= 7? >> >> 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 >> >> >> > > -- > C=C3=A9sar D. Rodas > Open Source developer > +595-983-161124 > PGP: F9ED A265 A3AB C8A1 D145 7368 158A 0336 C707 0AA6 > > --047d7b3a8cd010706c050f330142--