Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82831 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3322 invoked from network); 16 Feb 2015 12:17:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Feb 2015 12:17:11 -0000 Authentication-Results: pb1.pair.com smtp.mail=pajousek@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pajousek@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.181 as permitted sender) X-PHP-List-Original-Sender: pajousek@gmail.com X-Host-Fingerprint: 209.85.216.181 mail-qc0-f181.google.com Received: from [209.85.216.181] ([209.85.216.181:44195] helo=mail-qc0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DA/B1-29513-5CFD1E45 for ; Mon, 16 Feb 2015 07:17:09 -0500 Received: by mail-qc0-f181.google.com with SMTP id p6so23729484qcv.12 for ; Mon, 16 Feb 2015 04:17:07 -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=JW4zOAYNd8Xig4vhS2VGzSYNUM5jfYpXkWyOjd0GYgc=; b=h1Jx3wCSuAuUxUn0zCJGf1Yy2c9j7i9Iw0WU+jv+wzk2lxla2oo38xDjpsBo6EwNFf pjNOD7ZSqICAPP3B65pBmDoreCcCzcEzqc6mnzyA/exfn0elTzHa93Aon8fRmwnBeCHz 9aNYloeK9DWQfpqlrbL9RiQG26QuElvcDwKiFDICrqm4wsHkfYklDWkMQo1YnLvxabs/ dQbRF5GYRbUh/X8xpLObuVzCxDnQ252pch4WBR1M4H3Ps3IzxBITiIr4BRmxfLRw8JL+ SU6lk7LnvBVYO3ZpbPe48kEW/cy68XsnXGY405ib+9Ic7Pmch49ResH72ANDXqIfaG+i XBsg== MIME-Version: 1.0 X-Received: by 10.140.93.73 with SMTP id c67mr7067qge.53.1424089027535; Mon, 16 Feb 2015 04:17:07 -0800 (PST) Received: by 10.96.66.201 with HTTP; Mon, 16 Feb 2015 04:17:07 -0800 (PST) In-Reply-To: References: Date: Mon, 16 Feb 2015 13:17:07 +0100 Message-ID: To: Dmitry Stogov Cc: PHP Internals , Nikita Popov , Guilherme Blanco , Pierrick CHARRON , Alexander Lisachenko , Pierre Joye , Zeev Suraski , Andi Gutmans , Joe Watkins , Yasuo Ohgaki , Sebastian Bergmann , Stanislav Malyshev , Rasmus Lerdorf Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Annotations in PHP7 From: pajousek@gmail.com (=?UTF-8?Q?Pavel_Kou=C5=99il?=) 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 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... > > Thanks. Dmitry. Hello, I'd personally suggest you to consider that the Annotations could be classes, something along the lines of https://msdn.microsoft.com/en-us/library/aa288454%28v=vs.71%29.aspx#vcwlkattributestutorialanchor1 IMHO it will allow for more usecases and such than simple arrays. Regards Pavel Kouril