Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82813 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71351 invoked from network); 16 Feb 2015 11:07:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Feb 2015 11:07: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.177 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.177 mail-vc0-f177.google.com Received: from [209.85.220.177] ([209.85.220.177:62903] helo=mail-vc0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B2/0F-05176-56FC1E45 for ; Mon, 16 Feb 2015 06:07:20 -0500 Received: by mail-vc0-f177.google.com with SMTP id hy10so10281371vcb.8 for ; Mon, 16 Feb 2015 03:07:14 -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:date:message-id:subject:from:to:cc :content-type; bh=q1jyIqmQlOSFTPJd3eH7DFg7rZn7q1OmDN0GKTGck9c=; b=bvB8k8IMC347x+VUKtrOs/nmTELZBfkde0Hk3qR0NemCPuKTIOa/vKwzPn09lQqIBd jCKzEI/E1+4sSpBRLd0uPFPXjp2BeVW/45vRpAsGpbJxFTs4F57mjWfOwE3kaEr+acug 7dvLkZot+UF1b10Gu3KhMRWNkqTR7kDQBu/n9vym3O20MNnYIXbkjKr3PolEXu+HZy2u GCYJ6rrVURDMnTlerKkd3HZuV/HEFkjrNtjdcB6KzDp/wtb+AA20rDQrt8l+ABkHvvds l3N4CMzxq09iHFqnQJcNBIKzateQXXlO2X+lk5dmxJPqccpA1y5hB+DOnvVXocarugEc g+/Q== X-Gm-Message-State: ALoCoQmHUky787YdNHIlVhP48KBWQ5LF1lIUUqbGx5uPTN/T6KGEYZubzBNd6hEWrcl/ifYk7bXoBI9xgjs7BATJCKnFrkHUgV423a541TM/FQ4cwM+DejOxokV8WsMUsV0xbGUBjirZKr9++9YgEqR5O/vcZOlFaw== MIME-Version: 1.0 X-Received: by 10.221.18.136 with SMTP id qg8mr15609461vcb.27.1424084834198; Mon, 16 Feb 2015 03:07:14 -0800 (PST) Received: by 10.52.74.73 with HTTP; Mon, 16 Feb 2015 03:07:14 -0800 (PST) Date: Mon, 16 Feb 2015 15:07:14 +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=001a113399e6ac404c050f329614 Subject: Annotations in PHP7 From: dmitry@zend.com (Dmitry Stogov) --001a113399e6ac404c050f329614 Content-Type: text/plain; charset=UTF-8 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. --001a113399e6ac404c050f329614--