Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82930 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 41346 invoked from network); 17 Feb 2015 06:37:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Feb 2015 06:37:50 -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.182 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.182 mail-vc0-f182.google.com Received: from [209.85.220.182] ([209.85.220.182:51748] helo=mail-vc0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E6/23-24654-DB1E2E45 for ; Tue, 17 Feb 2015 01:37:50 -0500 Received: by mail-vc0-f182.google.com with SMTP id id10so12029462vcb.13 for ; Mon, 16 Feb 2015 22:37:46 -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=NJAog3mxgROTUuti3FxYynZlUFgYFxVaLpp3QRT/hdA=; b=ezNaPZjRtnuiA1uJuITAbHaSe+UDcsgIoxmnrszYIfcCHxvPb5JgY4Rg/F/aRta0aN 4kTK8Yc2Gi2UZCoVLLMyzuAuwmxL3LRM1l3DB3ksrzSgYMMa1sJR7ufrGNtiGsdyY8so x/XW5tLFQTxepYR/yrLOMxdKxFYivzGnCONWJEyj/0NVVUkqxvyUon4DSQ86DQ4woW1v 7l/zmpEU/mTlCTiwaNzNtaBKd2Eh/lVcy3OZZ+ARKMl2tRPCDWpU/hD2ZVQxiny/HKgr cn/8qC/BLPJwOS0oViqk3P4i7R83eQK/UuPcGl4uQZirHyd5EA4/GNTlst1Wx8S3exEi CKhw== X-Gm-Message-State: ALoCoQkIpFJuE27z9oN0JDvoWLG5sFEH0GDs2luZ9TFeN5LcnEz1eCh45wgpfPWckdccU+2hNDX5LCQhJWmX74QWkW4ZxyG0EJfwHuB/eJ5vEl2hTgbvuBbQ5t9pBoLJdzcYhTG1xgcS0p/YIoAI/Gm1/PN8GIsEqg== MIME-Version: 1.0 X-Received: by 10.220.185.193 with SMTP id cp1mr18417425vcb.80.1424155066347; Mon, 16 Feb 2015 22:37:46 -0800 (PST) Received: by 10.52.74.73 with HTTP; Mon, 16 Feb 2015 22:37:46 -0800 (PST) In-Reply-To: <01c401d04a64$1df25470$59d6fd50$@php.net> References: <01c401d04a64$1df25470$59d6fd50$@php.net> Date: Tue, 17 Feb 2015 10:37:46 +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=089e01538610d5ce64050f42f01b Subject: Re: [PHP-DEV] Re: Annotations in PHP7 From: dmitry@zend.com (Dmitry Stogov) --089e01538610d5ce64050f42f01b Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Tue, Feb 17, 2015 at 6:45 AM, Fran=C3=A7ois Laupretre wrote: > Hi Dmitry, > > In my mind, annotation syntax was one level lower, dealing with strings o= f > unknown syntax, not PHP expressions. Something like : > > '*' '@' STRING free-string-up-to-eol > > This supports : > > * @requires $a > 0 > Then you will have to parse the expression your self. > But also : > > * @statement INSERT INTO ?? VALUES (13, 'Phoenix', 'AZ', 33, 112) > This is not a problem, nobody prohibit quotes. > Using Reflection, the application would get an array of (STRING =3D> arra= y > of ) in order of appearance and that's all for th= e > annotation layer. Then, the client has the responsibility to interpret th= e > strings the way it wants. > > Even if it is a valid PHP expression, getting it as a string is not a > problem. DbC, for instance, would get the string, eval() them and error i= f > one of them evaluates to false. Performance must not be a problem with > annotations. This is what makes it suitable for DbC or offline metadata. > > If we restrict it to a PHP expression, you need to interpret it at compil= e > time, which makes the process more complex. I must admit I don't understa= nd > the reason, as the only one I see is performance. And I am totally out of > sync with suggestions to include namespaces, nested annotations, or using > class constants in expressions. I even feel incomfortable because it's ju= st > 'PHP code, but elsewhere'. I don't see the use case. > > About the syntax, I'm probably faulty there, but I don't understand why w= e > cannot use doc blocks. That's easy to parse at compile time, the API is > easy to define, the parser already parses them, and everyone is already > using that. Existing applications like doctrine just miss the API to use = it > in a cleaner way but it would be 100% compatible. Actually, I saw several > people refusing to consider doc blocks as annotations but I was never giv= en > the reason why. So, I am just curious. > Any one can use doc-block now and later, but php core won't parse doc-blocks. It's a task for external tools. > Anyway, I don't like the OO features people want to add everywhere. They > can get strings and inject them to OO, but that's not the role of the > annotation layer, IMHO. > > I definitely prefer the KISS approach. > I'm agree. Thanks. Dmitry. > > Regards > > Fran=C3=A7ois > > > --089e01538610d5ce64050f42f01b--