Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82825 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92955 invoked from network); 16 Feb 2015 11:59:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Feb 2015 11:59:43 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.171 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.171 mail-vc0-f171.google.com Received: from [209.85.220.171] ([209.85.220.171:54208] helo=mail-vc0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 99/23-05176-DABD1E45 for ; Mon, 16 Feb 2015 06:59:41 -0500 Received: by mail-vc0-f171.google.com with SMTP id kv19so10460472vcb.2 for ; Mon, 16 Feb 2015 03:59:39 -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=e9gZPZPzULMZFmCXZVPazyElfNTgeC9LoTi7G6gWQfw=; b=K3gQTOBvl5gwy5V7cOSK3baR/D/2d59kzK0A7Jz38hvaF8oWF5Ve+NE91tfdrPFrQ9 soJMbcCaDg/3qi4h0p2i+OkkZbifov3LZttx7ambKe58Fxf57Svlvrcr2qNUHt6lHe5B 5au3f267pAsCFxVtPiBp5TSv7hfK3J7JslgaMCPcguzQEfPdG7UYmvh2H0ez7VY/g3Fp m4W4S3vBOF8EKIVIF+0WF+YTLaYP1k3nv1m+4mTYtkVB1AJSrzp7p7Ak+K2nw62VBxKe hbNhnsTEmzit/cMyzyQmLMwUGm8JIBp+4fjBp2ZZEIhn807M7tRnRiFfgwMvzmQX5rnH 8sVw== X-Gm-Message-State: ALoCoQlDY8qwdeSv0lSnoolR25flGGFSZLjVFuwVFrB7hcjPIB4v4d0NOulsZKeH0UnJxA0MOPc7pKCnjbe3eN/lL2IyCEcGGJnU/zzNQ9L/2p5i19InxddnOwfZE/9NRX1PwF1knzOJT/a9FAp/RHUaHBo10HEZPg== MIME-Version: 1.0 X-Received: by 10.52.25.11 with SMTP id y11mr4606712vdf.51.1424087979080; Mon, 16 Feb 2015 03:59:39 -0800 (PST) Received: by 10.52.74.73 with HTTP; Mon, 16 Feb 2015 03:59:38 -0800 (PST) In-Reply-To: References: Date: Mon, 16 Feb 2015 15:59:38 +0400 Message-ID: To: Benjamin Eberlei 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=001a1133e5f21f540b050f335280 Subject: Re: [PHP-DEV] Annotations in PHP7 From: dmitry@zend.com (Dmitry Stogov) --001a1133e5f21f540b050f335280 Content-Type: text/plain; charset=UTF-8 yeah, it was a typo, that I fixed in first place, but not in the output On Mon, Feb 16, 2015 at 2:49 PM, Benjamin Eberlei wrote: > > > 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. >>>> >>> >>> >> > --001a1133e5f21f540b050f335280--