Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82823 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88559 invoked from network); 16 Feb 2015 11:42:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Feb 2015 11:42:16 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.180 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.180 mail-vc0-f180.google.com Received: from [209.85.220.180] ([209.85.220.180:50387] helo=mail-vc0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 26/62-05176-097D1E45 for ; Mon, 16 Feb 2015 06:42:10 -0500 Received: by mail-vc0-f180.google.com with SMTP id im6so10390003vcb.11 for ; Mon, 16 Feb 2015 03:42:02 -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=Hc4ESD/k/iYNSjOanFPIg3d/hrdol25Z9tHAsk4+rY8=; b=UYqlmhB7IlXF9rFPI2/Ejv5TOo3DvCig28DwcaydQtXFbtKt1RL/s3MCtYHszYveTU o2tVslY9nHm38Sm78/NuTSY1PxdSaE+jLTNarj2PwVS9nnXHprhgmfyRHQjbnuTZ/tvj Ub1WJze4PQ65v0prJgQIVVxssxo78eqP+7vKd7uhQ0dxj7dRoLryTkkY3pPC3C8FaP+M 70O2wGR1yZB25ZzwzahT20ZIRvhs0+ycetOT8aLiNSzZeLS7uERP0k9fKAYivvcyYtpd yKFBjpL6QXPKl2IdFNnIltHtzQdyujyezdm90JTmV+cu3Sjw0fkRb2E6xP0AYYfmv5zO 4qWw== X-Gm-Message-State: ALoCoQlVSnvtZBWAsNVdr0RS++ueoMllzr0mgunaDVFc+i66XdhubE10oIq5XmKrYFbtwIoaw+3C3ljUeOjZEOLMriT6W0MVeequsUXK8sF8Wnv74gwCOYEDGQwvZktR1sneqPtIwdNvREUAgdmvxszaTkTVyn5yZg== MIME-Version: 1.0 X-Received: by 10.220.5.195 with SMTP id 3mr15639662vcw.21.1424086922505; Mon, 16 Feb 2015 03:42:02 -0800 (PST) Received: by 10.52.74.73 with HTTP; Mon, 16 Feb 2015 03:42:02 -0800 (PST) In-Reply-To: References: Date: Mon, 16 Feb 2015 15:42:02 +0400 Message-ID: To: Benjamin Eberlei Cc: PHP Internals , 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=001a11c3ef802549bf050f331351 Subject: Re: [PHP-DEV] Annotations in PHP7 From: dmitry@zend.com (Dmitry Stogov) --001a11c3ef802549bf050f331351 Content-Type: text/plain; charset=UTF-8 the idea to not evaluate non-constant expressions at all, but just keep AST and provide interface to read it. PHP extensions should be able to use them as they like. (evaluate or insert into AST of function(s), etc). Thanks. Dmitry. On Mon, Feb 16, 2015 at 2:36 PM, Benjamin Eberlei wrote: > > > 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... >> > > oh please yes, yes yes :-) I don't care for the syntax, although this > looks ok. > > One question, when does the php expression get evaluated? > >> >> Thanks. Dmitry. >> > > --001a11c3ef802549bf050f331351--