Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82839 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 18043 invoked from network); 16 Feb 2015 12:47:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Feb 2015 12:47:22 -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:58188] helo=mail-vc0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EF/94-29513-9D6E1E45 for ; Mon, 16 Feb 2015 07:47:22 -0500 Received: by mail-vc0-f171.google.com with SMTP id kv19so10530223vcb.2 for ; Mon, 16 Feb 2015 04:47:19 -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=nm8rUkOp69dzt+VXCrcoZ6Spy9zQ7T0p5jt1dkRwzmM=; b=G8QkZORwMvQ4nVWd1n7XBfGVtKsunMbCHLkulp4r/gsNzlBha8LnI02cIhbfmp6u9m GGbVbTUoUUs5rLG9o07fDc58JReu3hjdzrvQ6pz6AOok1f8wvO4HZNvS6Zn3/G3wOzNU OUESoI8eIY1SG+oTvgjii/VPk+6W0VPJPZ2NwqYA0gfjfbsy4uZ/9KP7WQ7rcn6O5XQC aBnSPVlgwsEqVAREV22WCgl3BociKanLmLJVR9ZJCInX8Z8b5n/henH+PaWKYzKjkE/n FGBBUlBRpHlYp1Vwh4neyd6P6F5l3N8TFYASrPln/e6KMDKp1WUUI4w5guBV9ekonXOZ WB3g== X-Gm-Message-State: ALoCoQlVk2kXYYVeuE2bPp/VEwc1RvHNxljRG0D4sY9vLukTO7fIAcsGU5xfPge+gAx68snEF41uRG5aslG6GjJQ/KxXr+vl+O8xTJUES7LaUuU9H6lyaEwS3/BwDbUFCpewXK7HF9i0Il8QOcakP7ZYKnMsEenNTA== MIME-Version: 1.0 X-Received: by 10.52.52.136 with SMTP id t8mr13090965vdo.49.1424090839511; Mon, 16 Feb 2015 04:47:19 -0800 (PST) Received: by 10.52.74.73 with HTTP; Mon, 16 Feb 2015 04:47:19 -0800 (PST) In-Reply-To: References: Date: Mon, 16 Feb 2015 16:47:19 +0400 Message-ID: To: Nikita Popov Cc: PHP Internals , 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=089e0115f0489e0ba2050f33fc25 Subject: Re: Annotations in PHP7 From: dmitry@zend.com (Dmitry Stogov) --089e0115f0489e0ba2050f33fc25 Content-Type: text/plain; charset=UTF-8 The implementation is not going to be simple, and taking in account other tasks, it may be difficult to provide high-quality implementation. Lets look if it's really a desirable feature. Then I may do all my best, or forget about it by 7.1. Thanks. Dmitry. On Mon, Feb 16, 2015 at 3:14 PM, Nikita Popov 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... >> >> Thanks. Dmitry. >> > > Hi Dmitry! > > I think this is a great idea, but we should postpone it to PHP 7.1. > Especially if you want to make this AST based (which would require both > stabilizing the AST we return for expressions and having APIs to do codegen > based on the AST) it will require a lot of work both for design and > implementation. I don't think it's realistic to include a high-quality > implementation in PHP 7. > > As this does not have any BC concerns that I can see, I think it would be > safer to move this to PHP 7.1, when we will have more time to carefully > design this. > > Nikita > > --089e0115f0489e0ba2050f33fc25--