Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82818 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 80550 invoked from network); 16 Feb 2015 11:32:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Feb 2015 11:32:39 -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.174 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.174 mail-vc0-f174.google.com Received: from [209.85.220.174] ([209.85.220.174:49773] helo=mail-vc0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 04/B0-05176-655D1E45 for ; Mon, 16 Feb 2015 06:32:38 -0500 Received: by mail-vc0-f174.google.com with SMTP id id10so10431678vcb.5 for ; Mon, 16 Feb 2015 03:32:35 -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=zz42nJ7vrfPkYfmRlZ/J/BWfxJhtn8lDSmRO20VJIvI=; b=CBfuSZK1UQDYbZ20w3nTC2Ft74M6PYxw5g9zdWTApNXG/MjOnHaj0n4/ypsXsk8CnV Tbofx4eWa7kEjHSW97DUoJD2tyswc6+0M79t9arYYsZd+aAl64S08NgbOGZFoLB0bUG0 ovEkm2T+S29y81mH/qHvy5Z5gaKHEZSx8LHgmLTZNWaQ8qpKpgjdCVOXLIr8SjuZ8+Bv vXKs2exNr761U7IKLOEBRHOtRN7A8/hFqmIQngSgMwzeKVsoxk//aM+tLbyGu5PCJHG7 OdgQn/qltL9NYQSHM5b2QfcNTEm93QYTajYkY0+ftLSNpV6iYkPStzV83P3lysfP8GgR ADLw== X-Gm-Message-State: ALoCoQnadmC7bXFWw8VDsoUNhVE9UAg7Fy3nm0jjD7Rp+qycGm5Kbb9Oz39KOcw5zqOwevFkgX8PTwF7BrCERjw6d8KmS3TpYjJYSsgwi3GaufVojqiH8zEbpKRffTbluHtTDL6RuGQSVM/EsQnCwiEAiNkVA5W/cw== MIME-Version: 1.0 X-Received: by 10.52.162.72 with SMTP id xy8mr13080307vdb.12.1424086355208; Mon, 16 Feb 2015 03:32:35 -0800 (PST) Received: by 10.52.74.73 with HTTP; Mon, 16 Feb 2015 03:32:35 -0800 (PST) In-Reply-To: <54E1D2F8.30606@rodas.me> References: <54E1D2F8.30606@rodas.me> Date: Mon, 16 Feb 2015 15:32:35 +0400 Message-ID: To: Cesar Rodas Cc: PHP Internals Content-Type: multipart/alternative; boundary=089e0162832655039e050f32f141 Subject: Re: [PHP-DEV] Re: Annotations in PHP7 From: dmitry@zend.com (Dmitry Stogov) --089e0162832655039e050f32f141 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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, 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 Contrac= t" > >> 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.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 annotatio= ns > >> in PHP7 and how powerful they may be : > >> https://gist.github.com/dstogov/dbf2a8f46e43719bd2c2 > >> > >> The test there is self explainable. Of course, annotations just provid= e > a > >> way to add metadata, but doesn't define attribute names or the ways th= ey > >> 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 > > > --089e0162832655039e050f32f141--