Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82835 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11124 invoked from network); 16 Feb 2015 12:33:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Feb 2015 12:33:40 -0000 Authentication-Results: pb1.pair.com smtp.mail=kontakt@beberlei.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=kontakt@beberlei.de; sender-id=unknown Received-SPF: error (pb1.pair.com: domain beberlei.de from 74.125.82.41 cause and error) X-PHP-List-Original-Sender: kontakt@beberlei.de X-Host-Fingerprint: 74.125.82.41 mail-wg0-f41.google.com Received: from [74.125.82.41] ([74.125.82.41:50774] helo=mail-wg0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 62/43-29513-3A3E1E45 for ; Mon, 16 Feb 2015 07:33:40 -0500 Received: by mail-wg0-f41.google.com with SMTP id b13so29193736wgh.0 for ; Mon, 16 Feb 2015 04:33: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=8oU1+LWKESI4BYpcnJIg1mtXgQ/tWp+U71PtxKj9dnY=; b=QnzlaTE529+QHGYSwcg2XTl+wlldBG/1tZuKaTK5S+/wvyabP50htV10NA+Fn6TMC1 gd7mdfSsk3cpqlm32sc4acpW+JqChakwNM6q5WAJMKQi7V4R6kwPuULuefRvhg79+kRu LyoGeEJwy1id952CBxMGLXCQdpIJgB5/YxMb91pAiORW9Mmp0PSgfcDuMaAj0UD6RHam CbozWVu+pgrkFnQ0tzPlw4MiDnrnZ7wTUgW3zGDww6ghOXzLEp7EqSPgwTMZQVyxOAUW s4jK89vansxz37x5k3Uc+Wd/P8JG0KOfwGuMfrFr64WUh5UUztFEeOKVA/7s60EBWp8F a9qg== X-Gm-Message-State: ALoCoQlihX/VaZ1T6XaSysuHZ/GQtAbyCyQEC+5dukl7qU8Hm6E0X+2ZJrFLpZXHDzt+LKsNdzt3 MIME-Version: 1.0 X-Received: by 10.194.185.68 with SMTP id fa4mr48838498wjc.111.1424090015502; Mon, 16 Feb 2015 04:33:35 -0800 (PST) Received: by 10.194.192.202 with HTTP; Mon, 16 Feb 2015 04:33:35 -0800 (PST) X-Originating-IP: [93.129.131.180] In-Reply-To: References: Date: Mon, 16 Feb 2015 13:33:35 +0100 Message-ID: To: =?UTF-8?Q?Pavel_Kou=C5=99il?= Cc: Dmitry Stogov , 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: multipart/alternative; boundary=047d7bacb11e809f1b050f33cbcf Subject: Re: [PHP-DEV] Annotations in PHP7 From: kontakt@beberlei.de (Benjamin Eberlei) --047d7bacb11e809f1b050f33cbcf Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Mon, Feb 16, 2015 at 1:17 PM, Pavel Kou=C5=99il wro= te: > 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 annotation= s > 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 the= y > > 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=3Dvs.71%29.aspx#vcw= lkattributestutorialanchor1 > > IMHO it will allow for more usecases and such than simple arrays. > They are statements, so you can do whatever. Dimitri just showed scalars, but it would be possible to do: "FooRepository"]))> And then getAnnotations returns something along the lines if evaluated by the PHP Parser: "orm" =3D> [new Entity(....), ] So your requirement would be possible. > > Regards > Pavel Kouril > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --047d7bacb11e809f1b050f33cbcf--