Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82824 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 90749 invoked from network); 16 Feb 2015 11:49:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Feb 2015 11:49:42 -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.173 cause and error) X-PHP-List-Original-Sender: kontakt@beberlei.de X-Host-Fingerprint: 74.125.82.173 mail-we0-f173.google.com Received: from [74.125.82.173] ([74.125.82.173:48469] helo=mail-we0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AF/C2-05176-459D1E45 for ; Mon, 16 Feb 2015 06:49:41 -0500 Received: by mail-we0-f173.google.com with SMTP id w55so28726086wes.4 for ; Mon, 16 Feb 2015 03:49:36 -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=eB19zU6gmj69X2Unrb/9JkU1fE0fjqP2OB6tjmgqBhw=; b=j4sbCb0Y1BZH1g4O2WV+nJYqaq9TP5whC8LxrXoZLvg66Fy+KqUkBkuivqG9ythfta 8jdQ7JpDSN2dgiu1YkPpx383I1+3mzDt3feD6Zlf868nYltFSFNSIcjl4qRf3A9dnvxr WyDu6aC4xK4tra291Rbh4xwFOvrgIpT0yX2e54XQY+bT5E7uuLCWHfTJZ/8iEJnso17p ql51wtprsIyihDQSsZgX+0JkEapcz6X0qFMFCSBSEr4Fha2Jt8FrOWlYzFyqC7/EhAeS FMD+aQoWolCZKm4z00E3/1zi66Szc53ZbqGHFnIYzxPz2tK4P+wUI065A6VJmVuUwH+e Y8/w== X-Gm-Message-State: ALoCoQm0YOQuoxqW8C72BLjhzgMgCyrSJMzmttZjok/yYWsPPlV6snYg92cVUwHi4J55g40l1WQV MIME-Version: 1.0 X-Received: by 10.194.185.9 with SMTP id ey9mr35384220wjc.135.1424087376607; Mon, 16 Feb 2015 03:49:36 -0800 (PST) Received: by 10.194.192.202 with HTTP; Mon, 16 Feb 2015 03:49:36 -0800 (PST) X-Originating-IP: [93.129.131.180] In-Reply-To: References: Date: Mon, 16 Feb 2015 12:49:36 +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: multipart/alternative; boundary=047d7bd6adce365096050f332e67 Subject: Re: [PHP-DEV] Annotations in PHP7 From: kontakt@beberlei.de (Benjamin Eberlei) --047d7bd6adce365096050f332e67 Content-Type: text/plain; charset=UTF-8 On Mon, Feb 16, 2015 at 12:42 PM, Dmitry Stogov wrote: > the idea to not evaluate non-constant expressions at all, but just keep > AST and provide interface to read it. > PHP extensions should be able to use them as they like. (evaluate or > insert into AST of function(s), etc). > Ok so this would expose the AST to userland? Because that is not yet done or? As a userland developer I would prefer having the values evaluated, for example using the array expresssion syntax in class properties (only "constants" expressions allowed). Looking at the PHPT more, there seems to be a typo, requires is used in the annotation and requres is in the var_dump? > > Thanks. Dmitry. > > On Mon, Feb 16, 2015 at 2:36 PM, Benjamin Eberlei > wrote: > >> >> >> 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... >>> >> >> oh please yes, yes yes :-) I don't care for the syntax, although this >> looks ok. >> >> One question, when does the php expression get evaluated? >> >>> >>> Thanks. Dmitry. >>> >> >> > --047d7bd6adce365096050f332e67--