Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82850 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49725 invoked from network); 16 Feb 2015 14:56:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Feb 2015 14:56:07 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.47 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.192.47 mail-qg0-f47.google.com Received: from [209.85.192.47] ([209.85.192.47:51094] helo=mail-qg0-f47.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 61/E1-36518-50502E45 for ; Mon, 16 Feb 2015 09:56:05 -0500 Received: by mail-qg0-f47.google.com with SMTP id q107so23620110qgd.6 for ; Mon, 16 Feb 2015 06:56:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=jozolBxsOmMoH0BrUXJOmIryqVMAwaSzpXJ1+6Hg88E=; b=pnw24N3BlHLs800IdkOkxzgMq1/oRnJ2yYJJREuaHs4gM7lhW/OoNVb2ck2S9oqiqI /YxN0sL9UsBMfpw8QtwW5yRerPIJJKOdnSx8XS5zxAmZ30v32xcVoGmUYwz1cn/OBa3Q ZdZZ/R34K+Rv1VW16AvTVlvVUTHE7MWBsyfk4pdQuBOsmm7+pjXwxOo+fkKJ/XKAT5O3 qOI9Ic09EltPoF//pCnKKbln6Cl6V73bR9tiQZnZ6R1tPvuPo96pG2mJBugqBqTwr7du cmMzxghsMG3ZbCmgioCHUrC63fqCdFbWw/pxrnT06kwkI8Fqp+GGyWvzDmgiOLmyfMfm mBeQ== MIME-Version: 1.0 X-Received: by 10.140.149.130 with SMTP id 124mr391930qhv.40.1424098562934; Mon, 16 Feb 2015 06:56:02 -0800 (PST) Received: by 10.96.39.195 with HTTP; Mon, 16 Feb 2015 06:56:02 -0800 (PST) In-Reply-To: References: Date: Mon, 16 Feb 2015 06:56:02 -0800 Message-ID: To: Dmitry Stogov Cc: PHP Internals , Nikita Popov , Guilherme Blanco , Pierrick CHARRON , Alexander Lisachenko , Zeev Suraski , Andi Gutmans , Joe Watkins , Yasuo Ohgaki , Sebastian Bergmann , Stanislav Malyshev , Rasmus Lerdorf Content-Type: text/plain; charset=UTF-8 Subject: Re: Annotations in PHP7 From: pierre.php@gmail.com (Pierre Joye) On Mon, Feb 16, 2015 at 3:07 AM, Dmitry Stogov wrote: > hi, > > During discussion of different ways of implementing "Design by Contract" we > got an idea of using annotations. Thanks a lot to push that forward! > 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 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... Is it the branch/fork available? I think the best way to validate a soluton (and its specs) is to try to port existing annotations needs using this syntax (like Doctrine's one). Even if the syntax is different, it will show if the syntax is powerful enough to cover what is already used. I am not saying we need to support everything but only what is necessary to actually implement existing annotations (which have been used for quite some time and proven to be very useful) using this syntax. I would also leave the docblock/comments idea out of the discussions, it is really not what annotations are. If we can spare us that part of the debate, we can focus on the actual specs and implementations. :) Cheers, -- Pierre @pierrejoye | http://www.libgd.org