Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82829 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 264 invoked from network); 16 Feb 2015 12:14:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Feb 2015 12:14:36 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.178 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 74.125.82.178 mail-we0-f178.google.com Received: from [74.125.82.178] ([74.125.82.178:65491] helo=mail-we0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 40/11-29513-B2FD1E45 for ; Mon, 16 Feb 2015 07:14:36 -0500 Received: by mail-we0-f178.google.com with SMTP id w62so28788620wes.9 for ; Mon, 16 Feb 2015 04:14:33 -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=TljquXpnVXb25gvzl4zpt94zvI+9D7lR7VfHzDfF7wk=; b=frzQCo12Usa0Oiu9SkHDScHhzCZzktzs7RvX/dxC2vApSXBVGv59v9QbK8mj7NNItp CWDNMChLySbz5qJmkuCuwii4lpm6jFIPe6OL38KbYZKw6wnaAMWte6CAdwUELdfFFcqj CLW2N9gEMVT+E/0sbFo53hgibYOAUELUMnPbz79Jr3jZjSJfw3JACEeoO3Bokd3MnhcT Smu+Llo47ChGfprSwzAGg7iP7qK6ZuqxB/hmuuxn8XwbpUyt1uOw5ZfvRyDry90VcucH HVAlufPim9RHqaf5opg72koRmYtGBPQOqfWucUP3bu8wBZT2yWYVHjyKfz+cl66gBCBK jeYA== MIME-Version: 1.0 X-Received: by 10.194.71.175 with SMTP id w15mr43967209wju.16.1424088872971; Mon, 16 Feb 2015 04:14:32 -0800 (PST) Received: by 10.27.10.168 with HTTP; Mon, 16 Feb 2015 04:14:32 -0800 (PST) In-Reply-To: References: Date: Mon, 16 Feb 2015 13:14:32 +0100 Message-ID: To: Dmitry Stogov 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=047d7bfcf00066f42c050f338749 Subject: Re: Annotations in PHP7 From: nikita.ppv@gmail.com (Nikita Popov) --047d7bfcf00066f42c050f338749 Content-Type: text/plain; charset=UTF-8 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 --047d7bfcf00066f42c050f338749--