Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82895 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 50243 invoked from network); 16 Feb 2015 22:16:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Feb 2015 22:16:26 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.51 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.216.51 mail-qa0-f51.google.com Received: from [209.85.216.51] ([209.85.216.51:44549] helo=mail-qa0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A9/12-36518-93C62E45 for ; Mon, 16 Feb 2015 17:16:25 -0500 Received: by mail-qa0-f51.google.com with SMTP id i13so23872788qae.10 for ; Mon, 16 Feb 2015 14:16:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=F4l30i1CLQyy7kNpO5vBFu5q/cmorhMtSkPeWHlEaCk=; b=cK7gRhUFio5pvnXjumgzvAhpx3oTdQpvzuaFPShHZB5EZvbFGG6/x1XwHY9js37M0J A1GLZ2yB7Djg4vJ4veEdLxunDdBitiy68RYdcSHcMl43Ww3sZdz77TxOr/1t7rg6xxBU flr4SHC+vKW8oQxoA5Zm+ZxRq7aJkWE9p+BrA6Be1ZdSKDT/MNUxwGvqv5RTxp7ewhPE 6wQEr/s/kj3jknza1bYfzFl9+aaq0dxwhzY4vEsx+TKBqMkhc8dP36BI2T9iHEaWaL7m g1Wg/MZFu7E6sXb45NocSk225zHvq7JVaGySTbHJFEaDzWQUli6YrkIfIp4QPFmmA7FH Opwg== X-Received: by 10.140.194.204 with SMTP id p195mr1117808qha.21.1424124982956; Mon, 16 Feb 2015 14:16:22 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.229.198.8 with HTTP; Mon, 16 Feb 2015 14:15:42 -0800 (PST) In-Reply-To: References: Date: Tue, 17 Feb 2015 07:15:42 +0900 X-Google-Sender-Auth: y5FHrGB0GPpx9oZeIrZQDHxIw7c Message-ID: To: Dmitry Stogov Cc: PHP Internals , Nikita Popov , Guilherme Blanco , Pierrick CHARRON , Alexander Lisachenko , Pierre Joye , Zeev Suraski , Andi Gutmans , Joe Watkins , Sebastian Bergmann , Stanislav Malyshev , Rasmus Lerdorf Content-Type: multipart/alternative; boundary=001a1143245eb9a7e1050f3befcb Subject: Re: Annotations in PHP7 From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a1143245eb9a7e1050f3befcb Content-Type: text/plain; charset=UTF-8 Hi Dmitry, On Mon, Feb 16, 2015 at 8:07 PM, Dmitry Stogov wrote: > 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... > Although, I prefer simple DbC as PHP syntax, my priority is introducing DbC to PHP. No problem for me. For both annotation and PHP syntax, we should concentrate "simple" (i.e. without strong type safety. Don't read me wrong, I'm not saying without type check) DbC. IMHO. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --001a1143245eb9a7e1050f3befcb--