Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82982 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 86182 invoked from network); 17 Feb 2015 16:30:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Feb 2015 16:30:21 -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.172 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.172 mail-vc0-f172.google.com Received: from [209.85.220.172] ([209.85.220.172:48384] helo=mail-vc0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4D/A3-19463-C9C63E45 for ; Tue, 17 Feb 2015 11:30:20 -0500 Received: by mail-vc0-f172.google.com with SMTP id kv7so12817869vcb.3 for ; Tue, 17 Feb 2015 08:30:18 -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=DozX018enPCSKuZvaKdIaAPTyilY0tlkVohljQrz0/Y=; b=SZMJBp8nBUa++3owbyf1xjYC34J2ZN3d5MXSsOO8xyAOiUBTlv1XC+oBoEaueWmMrS WmuPp8Uv1Bln2YOVZRZu3y3H+G0Od3nve8tzRvAwxR/rN1eFAIL3UOF3sDVid+fZzLzW cpSm7lDRGeDeqe3HGmvDVrHu0YxemC0mYzY0Ec8kCL6hOZjiVz9djosegjMHz1jZfJAO VEgN5Xx1MjvXcFvLSEgQFqgCIVSR+JIZcdRicqTn4ZZCa8pGnXXGBfU9boL4lqOJsBqp lc9m0HRRZJ4qHaRl8CuYoxjBZMGSapRCB31xXjq6EI3XoZBmryzBHO2kiSBRm3k99HQX +NEw== X-Gm-Message-State: ALoCoQk5hlW+8teeXMc+JvWBP0ma5ihYG0R/Rs8C09/TJ1y9VJaTo/XqpupEWD73KSJx+9nTUJ97n+5IsjWlBFcEIk4CS/c9+FlGYwJLVBY6xNR1SiYAhB9bd3WRL32JO5oe0rswQDtFlJ+kxa/5JqRyHbntaeS8iw== MIME-Version: 1.0 X-Received: by 10.221.44.65 with SMTP id uf1mr19613980vcb.46.1424190617949; Tue, 17 Feb 2015 08:30:17 -0800 (PST) Received: by 10.52.74.73 with HTTP; Tue, 17 Feb 2015 08:30:17 -0800 (PST) In-Reply-To: <024101d04ab8$b880a1a0$2981e4e0$@php.net> References: <01c401d04a64$1df25470$59d6fd50$@php.net> <024101d04ab8$b880a1a0$2981e4e0$@php.net> Date: Tue, 17 Feb 2015 20:30:17 +0400 Message-ID: To: francois 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=001a11c3ea3ce0417b050f4b37f8 Subject: Re: [PHP-DEV] Re: Annotations in PHP7 From: dmitry@zend.com (Dmitry Stogov) --001a11c3ea3ce0417b050f4b37f8 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Tue, Feb 17, 2015 at 4:50 PM, Fran=C3=A7ois Laupretre wrote: > HI Dmitry, > > Question : in which scope do you evaluate the PHP expression ? > We don't evaluate expressions. We just store them. Evaluation and/or modification is a subject for future development. > > Example : > > 0);> > 0);> > > function foo($a) > { > ... > > How can you know from this that the first expression must be evaluated at > function entry, that the second one must be interpreted when function > exits, let alone the question of __RETURN__ replacement and external swit= ch > to authorize/disable DbC evaluations. > If we will support such DbC approach, then an additional extension may use this attributes to insert their code into appropriate places of main function. Thanks. Dmitry. > Several people rightly stated that expression would be computed at compil= e > time. That's a way to solve the scope question as it practically means th= at > expressions are evaluated in the global scope, but DbC must evaluate its > expressions at runtime. Does it mean we should write ' > 0')> ? Not very intuitive but that's probably the only solution. > > Something else : I am not sure I understand, but do you intend evaluating > annotation expressions everytime you parse the file. Or would you provide= a > global switch ? > > > Any one can use doc-block now and later, but php core won't parse > doc-blocks. It's a task for external tools. > > I understand. Actually, DbC is not the perfect use case for annotations. > It would be fine to find a good use case because neither of DbC, AOP, > Doctrine, or phpdoc fit so well. > > There comes my last question : is it so interesting and mandatory to > implement annotations in the core, instead of an extension which would > parse doc blocks when needed, and would return bare strings through a > reflection-like API ? I know most want to put annotations in the core, bu= t > what's the real benefit, if we don't consider performance ? Do we have us= e > cases comparing both approaches ? > > The fact that we voluntarily make it incompatible with phpdoc and doctrin= e > 'annotations' saddens me a bit too because people used to the current > 'annotation' meaning will have to integrate that a new PHP native > 'annotation' feature, totally different from what they've been using for > years. And doctrine is not an edge-case. If there are good reasons, why > not, but I don't see them yet. > > Regards > > Fran=C3=A7ois > > > > --001a11c3ea3ce0417b050f4b37f8--