Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82815 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75287 invoked from network); 16 Feb 2015 11:19:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Feb 2015 11:19:38 -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.174 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.174 mail-vc0-f174.google.com Received: from [209.85.220.174] ([209.85.220.174:59448] helo=mail-vc0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 41/BF-05176-942D1E45 for ; Mon, 16 Feb 2015 06:19:37 -0500 Received: by mail-vc0-f174.google.com with SMTP id id10so10414073vcb.5 for ; Mon, 16 Feb 2015 03:19:34 -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=mHHbcgx3X6v53QJCtiWJrZAiOcmUTOEAfRdudroRsqw=; b=OQShJq0KY8PLsg/wSlEQE0wIt+QceLZq6pfCxPFlGNTsSXaFnFta0buVmLEUUMn+Mn FtTaqPrG0ue8hejRbQHX4ibHlIRyT2Pasxc/jyXRo/0OeWOt0QWGBBxrww0E+OLJPXQi +O5THsCj42lshZw3YYUrkbzAgO8APaMCEdc6v93D2M1pLFQ6pwr9rveghFKYXepI8av5 a/HSHsIQ8a/XRn1uombBLxIPUj4t1vGiTJnFPVW3hgLboXVnOyHCHJaCFAbjEGJA42yQ mf9SCfwZFeSSIWLtenn2x3w8K/kcPkJwBKHUnebxUZ3qUwELp2rb5UxCPn7vE2RUkWyh ecjg== X-Gm-Message-State: ALoCoQmSytQsUUzBUk63FVWrEJrZ6qj3MeK23Z+xkXCkfx9cFsiCRdebr657V30tkcW/+EcKiEvXfZefx7z7Q0kaYC+qRT1Cswzwxdk9bSswEdNdcgU2/unFTVvXGLxqoSNR2sJ0t7Y4v3FlstTF4NLzUSBxRtwniw== MIME-Version: 1.0 X-Received: by 10.221.18.136 with SMTP id qg8mr15629139vcb.27.1424085574318; Mon, 16 Feb 2015 03:19:34 -0800 (PST) Received: by 10.52.74.73 with HTTP; Mon, 16 Feb 2015 03:19:34 -0800 (PST) In-Reply-To: References: Date: Mon, 16 Feb 2015 15:19:34 +0400 Message-ID: To: PHP Internals Cc: 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=001a113399e6c980b5050f32c2fe Subject: Re: Annotations in PHP7 From: dmitry@zend.com (Dmitry Stogov) --001a113399e6c980b5050f32c2fe Content-Type: text/plain; charset=UTF-8 I decided to explain the proposed annotation syntax "in words" to avoid misunderstanding annotations ::= { annotation }. annotation ::= '<' STRING '>' | '<' STRING '(' expr ')' '>'. where is regular PHP expression. Thanks. Dmitry. On Mon, Feb 16, 2015 at 2: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. > --001a113399e6c980b5050f32c2fe--