Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82896 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 52253 invoked from network); 16 Feb 2015 22:24:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Feb 2015 22:24:26 -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.169 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.169 mail-vc0-f169.google.com Received: from [209.85.220.169] ([209.85.220.169:64658] helo=mail-vc0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 90/72-36518-91E62E45 for ; Mon, 16 Feb 2015 17:24:25 -0500 Received: by mail-vc0-f169.google.com with SMTP id kv19so11475670vcb.0 for ; Mon, 16 Feb 2015 14:24:22 -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=xfvnx8ypsq8qtZk6uivypeFDDKaPWFd7IfZQMDVrWYk=; b=LtEb5QpkOTO4NoLJhOL3DroEtVcm4m/OQpZEiCYGCsvVUXGzmXEA1bPmNwQFaDH9cD cIpZEJ/3NHFsSDnmPIdxB2Rm5Oa8jpDWsVGixr/VyZs3pErTeQB8UWIz7ppV/yzERkXL sEMP2Nz19a5e/lWk0d7zTEynQx+N3YYawYt3xzDUaGGGGPEA0PpQ8dh2u0xtNlo3ewT/ 0iFKIc/sAACUiaGZoGcYs8f8CoEvSsTVFc4p0+skBZwjljZWmTePsG8ZPldo420kj2yp zTXF7Pt2EvIJXtsoqHfMXZI/A49K9f24iY3XzNA1XGtrAvNWH3znVZgRXPL/c0EFvRcN 1/Kg== X-Gm-Message-State: ALoCoQkquJNeNdRzrEqrLADfj/MwKWjC9B+uL2sXQMxv5bEQmUoK63gDolWMzj8OmqJ1atRE5GljZ0wkSrpMpFr2CNMFpr968ckwEUppC7dVolXOJ+95zQIFcTWVc07PwIn0wN7dHzJO+wyrc0/YH1a5y8yHy7ygKw== MIME-Version: 1.0 X-Received: by 10.52.27.178 with SMTP id u18mr4334883vdg.38.1424125461969; Mon, 16 Feb 2015 14:24:21 -0800 (PST) Received: by 10.52.74.73 with HTTP; Mon, 16 Feb 2015 14:24:21 -0800 (PST) In-Reply-To: References: Date: Tue, 17 Feb 2015 02:24:21 +0400 Message-ID: To: Yasuo Ohgaki 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=20cf307c9d0246d862050f3c0cd1 Subject: Re: Annotations in PHP7 From: dmitry@zend.com (Dmitry Stogov) --20cf307c9d0246d862050f3c0cd1 Content-Type: text/plain; charset=UTF-8 On Tue, Feb 17, 2015 at 1:15 AM, Yasuo Ohgaki wrote: > 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. > I don't have strong opinion - what is better for DbC, PHP syntax or annotations. Now I made some research on annotations, because I think it may be useful not only for DbC. Thanks. Dmitry. > 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 > --20cf307c9d0246d862050f3c0cd1--