Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93378 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16965 invoked from network); 17 May 2016 15:30:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 May 2016 15:30:36 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.49 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.49 mail-wm0-f49.google.com Received: from [74.125.82.49] ([74.125.82.49:38792] helo=mail-wm0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B1/01-11000-B193B375 for ; Tue, 17 May 2016 11:30:36 -0400 Received: by mail-wm0-f49.google.com with SMTP id g17so37553423wme.1 for ; Tue, 17 May 2016 08:30:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=Fjb1FDBN8y8snyzWId8OF48CA2FIuNXqeV94jYwJ00o=; b=k1S/PFQdbNyF8WIo6Dl0xZEEHruakqesQ+TVy/+luKA0qx532bOKX4gRINFMzvQfTo d5KCSh9j1Q4cl/BCOKmi5TjU6cjV0c2kDhPZcu9PgiPsXKshtIWI4WObbSlngH+sFHqj tj0WWIR2fVeGAAJgeCvcKiwiGlkQkeDaRLZ4JBPmiDh1kOYMj4/3M6Y7Wce2KNigbWMy BgeZ4rFwij4nbpb3+tOH94MGckuoqCOtvb7XciyGYb+Tz50kAofkE5pg/Dal5Wj3B0z/ HuvpcTLKlDVfRqy/bYi649sgYAflCy4Lp2/LzSmoDOIkbLNrRfJtRDF1vYruLqPALKh9 P3xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=Fjb1FDBN8y8snyzWId8OF48CA2FIuNXqeV94jYwJ00o=; b=BjBFXxXrx6S1iQPIGUa8D0qrFBlKMTbNc7gLMdCA5kU7IbsX9jWLMGlKmD+WxTkGeP Z9siVcgtUpjooZnZsZB6dDP3dCPMODMyGRr5VIu4lZASdD8XuySSkqtr9C4WoaGEDLSK Yf7d3gbXEw1E1nPN6tPNdgt8dx9XxGSz4/kwLM6ewlzPtegv+eDqI3mC4L5NbaPV/A0U RzrrNLcQVvM7fBDj3IogBtQvZw8YnPw9vuj4lzDRUfYa51NKOduUJ6rbXuuuFbhaWJh/ 1PMRr9Z+vMzdDyjR7YaA/AjXUmQi+Enuqgj04BbTk3t4fEjwMXlIzT8qWfg3RsJTtRGb fL/w== X-Gm-Message-State: AOPr4FWHJmKziagmewyZmFjwkp7eGWhz+aNwTMvy84G0U7VEvxHBYL4lWi5ZGWS+8ZS7Hg== X-Received: by 10.28.111.14 with SMTP id k14mr2292444wmc.32.1463499032975; Tue, 17 May 2016 08:30:32 -0700 (PDT) Received: from [192.168.0.98] ([93.188.182.58]) by smtp.gmail.com with ESMTPSA id on2sm3704029wjc.32.2016.05.17.08.30.32 for (version=TLSv1/SSLv3 cipher=OTHER); Tue, 17 May 2016 08:30:32 -0700 (PDT) To: internals@lists.php.net References: <61e6a083-91c2-799f-9757-02f56fe184e9@gmail.com> Message-ID: Date: Tue, 17 May 2016 16:28:36 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Simple Annotations From: rowan.collins@gmail.com (Rowan Collins) On 17/05/2016 15:22, Rasmus Schultz wrote: > The other issue is the dependency (context) injection example - no one > seems to be able to cite an actual use-case, and if that's the case, I > should probably just remove it from the RFC entirely? > > @Larry can you think of a case example in the myriad annotations > you've seen in Drupal code? :-) > > Anyone else using Doctrine Annotations actually seen anyone making use > of a closure in an annotation? Possibly nobody's responded to your call for an example because they're not sure what it is you're asking for an example of. I don't really understand what closures have to do with annotations, or how that relates to capturing context. An example from the other thread of a context-bound annotation would be implementing validation like this: <> function foo(int $percentage) This would appear to be unsupported as such by your proposal, so you would instead just have to use strings to represent how it needed to be accessed: <> and then have extra machinery in the reflection logic to extract the parameters and pass them to the object, e.g. $annotation->validate($reflected_parameters) This might be the more sensible approach to such an annotation anyway, but without any access to variables, I don't really understand the value of evaluating an expression for the annotation, just to get a constant value that is cached by the Reflection infrastructure. If the expression would have to be made up entirely of constants anyway, might the same "constant expressions" used in class const definitions be a better fit than "any valid PHP expression" - plus a specific exception for creating objects out of those constant expressions. Regards, -- Rowan Collins [IMSoP]