Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92705 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75812 invoked from network); 25 Apr 2016 03:23:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Apr 2016 03:23:11 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.173 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.192.173 mail-pf0-f173.google.com Received: from [209.85.192.173] ([209.85.192.173:33479] helo=mail-pf0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 09/A9-13951-D9D8D175 for ; Sun, 24 Apr 2016 23:23:10 -0400 Received: by mail-pf0-f173.google.com with SMTP id 206so11994713pfu.0 for ; Sun, 24 Apr 2016 20:23:09 -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=SdYp2fdpGgOgGQH2GdsxV5WRX9s+DEszARMEg3J4q8s=; b=gCZoMFLzSZrPkzxqcMLvdJDFUMFemIUPpZRpWwuPUFrmQU+F8NWuFvG7cbk83pjkUi i1MG0yQ7Z3zHgf7yBSUaXv8UJvPw6at4lD+Oz5FbJeGYRzG0KJlWzJLSuWseknaSt5yj 6dUu59o1Foo7d0mWvOzjS4XaBd1B4CC/om455KWdbfN5b2Qurnp7ag9AgaZiuWpfEQP+ oJnF4ZQ7ynU6Qlb9P+qnkzuYBAQvq5a1AYgj9biLgZuxRNiHLnhTdlhvBX5zTbMcUnhQ 84OzM3UA5YJwmhnEWM8w6Q3fB7IMpaDghJCxJrmZiNXyizoL3NxFn0NZM9fh87rfcakx qUGQ== 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=SdYp2fdpGgOgGQH2GdsxV5WRX9s+DEszARMEg3J4q8s=; b=kveTTTcqSIeqHSLbMxGO5WwMwkkakEFPHcce1Iv25aEuYoePdbVuXqhizn/uYpjXK1 5G4Xsl9GMFEbuvd2HCjj6spw9ayqBTrzeQFXRBbe0IB5Py85LxrQi+NDnvpJPCmrrFF3 AMp2SF/Ocrqo7HlUCIJNpMO6RV+mZIh4CHj4ZH2UdkZF4LvkDxY6ycajaUZ4zNoP43NG p84tuxdYjwnXqKWkMl/RykOCMRlgUWVCYghslEVBPNG4wWd6XfYGnsQNbDzyKSkBkHgP nS9fg2WncNJoaX4QCNxB+juGdt9lC7Uv10aQmeK+WIjlK+/2YbOOJDDuc5jWk5T+ttvN CQGw== X-Gm-Message-State: AOPr4FW7V674Gy/PpXu8NvwIgIDmqD05ym5hHOS3PrifIXZFgJDk9S8iCcM5Tu5tGYJO7g== X-Received: by 10.98.101.199 with SMTP id z190mr7000357pfb.1.1461554586365; Sun, 24 Apr 2016 20:23:06 -0700 (PDT) Received: from Stas-Air.local (76-220-46-95.lightspeed.sntcca.sbcglobal.net. [76.220.46.95]) by smtp.gmail.com with ESMTPSA id s26sm24094889pfa.0.2016.04.24.20.23.04 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 24 Apr 2016 20:23:05 -0700 (PDT) To: Dmitry Stogov , internals References: Message-ID: <571D8D95.7050107@gmail.com> Date: Sun, 24 Apr 2016 20:23:01 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] PHP Attributes From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > https://wiki.php.net/rfc/attributes I've read the proposal and I like the idea of reviving the attributes idea and the simplicity of the approach. I have the following questions for it: - Namespacing. Since the attribute names are not processed in any way according to spec, it may be rather hard to ensure attribute requirements from different domains do not conflict, and we do not get into the same problem we've got into with class names before we implemented namespaces. How it is planned to address the issue? - The expressions support is nice, however I'm not sure I understand what PHP application is supposed to do with syntax trees? I.e. taking the example in the RFC, if I got AST\Node representing < 0)>>, how do I use it? Would I implement mini-PHP-engine in PHP to evaluate such an expression? Am I supposed to use some other functionality to do it? It is unclear. I don't think promoting reimplementing PHP expressions in a myriad of different ways (which all would be subtly different and distinct from how PHP understands such expressions) is not good, and if we expose those trees we should also provide means to work with them. Otherwise any advanced usage of the feature would mean basically reimplementing PHP engine in PHP. As a side note, my personal opinion is that for about 90% of use cases expressions are not needed. For 90% of those which are needed, string + some form of eval would cover it's use case since all the'd be doing is evaluating the expression and checking the resulting value. - As far as I can see, AST extension has no documentation except for initial README. If it is going to end up in core, this needs to be fixed. Preferably before it is merged into core. - I would also consider moving AST namespace under \PHP since we have this one reserved (unlike \AST which we did not reserve). - Are attributes also allowed to apply to anonymous classes/functions? Would the syntax still work in that case? _ I also think <<...>> syntax is ugly and @attribute syntax would be much better (and also is used in Java attributes and Python decorators). That's my personal opinion though. Thanks, -- Stas Malyshev smalyshev@gmail.com