Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92712 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 267 invoked from network); 25 Apr 2016 08:22:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Apr 2016 08:22:04 -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 157.56.111.104 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 157.56.111.104 mail-bn1bbn0104.outbound.protection.outlook.com Received: from [157.56.111.104] ([157.56.111.104:1953] helo=na01-bn1-obe.outbound.protection.outlook.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 40/00-00233-AA3DD175 for ; Mon, 25 Apr 2016 04:22:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=RWSoftware.onmicrosoft.com; s=selector1-zend-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Re0LxnO5g3neczR5SfKqhhkeUG/ZcR26J4O2rKMu04M=; b=mugKakZRI+fJPBO7PR0gg9VfV2hkeZ1UTeI8KjLwKN2AvlGCvSj7W4lALHcWe4oc1WwQlyPN5wIrzU8IyvToJTX2jlr365zxEcP2OK0uZ1A6DQgWzTC4IZK1CAYZycHPSCrvBHsiHE2c+3h8wy6vABgAcD6PrBedd83HMZL5CI8= Authentication-Results: lists.php.net; dkim=none (message not signed) header.d=none;lists.php.net; dmarc=none action=none header.from=zend.com; Received: from tpl2.home (92.62.57.172) by BLUPR0201MB1779.namprd02.prod.outlook.com (10.162.239.13) with Microsoft SMTP Server (TLS) id 15.1.477.8; Mon, 25 Apr 2016 08:21:58 +0000 To: Thomas Punt , internals References: <571B51CF.9040901@zend.com> Message-ID: <571DD397.9090007@zend.com> Date: Mon, 25 Apr 2016 11:21:43 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [92.62.57.172] X-ClientProxiedBy: AM3PR08CA0034.eurprd08.prod.outlook.com (10.160.207.172) To BLUPR0201MB1779.namprd02.prod.outlook.com (10.162.239.13) X-MS-Office365-Filtering-Correlation-Id: 699d806a-a209-40a1-6a81-08d36ce2abd5 X-Microsoft-Exchange-Diagnostics: 1;BLUPR0201MB1779;2:vEk6ZApPmPCtIjaidiQqzVtn8wjR7Dy05dQ41T+053qsRuUcnPos5kVYT4ktupRf0xszm956W9d/xDsc3Ibi9tHzsD1kAAOQEFKK+L8jb7yXmiL4tONoux0PTYTi+zE2a+XdTDL4oeNzsvg1ZJy/zJo/r5D6UOUa8lM9oi5tWO1x/DK0+rtB+C703PNVPXOJ;3:DzZZoJoF4zgkPEmQSr4ooaof/JUq0gat7rlfKTcPSRkkJhcCEFTHMXOjEHVf9DV8dT64eg1nwyu1pNQv4XLnmnTclPyuGdwQYrcBqcR95RxpjZT4rZKXgxo3sxoc9igy X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR0201MB1779; X-Microsoft-Exchange-Diagnostics: 1;BLUPR0201MB1779;25:EKUvFi1dXdM9qUd3X90BI2MCZct6MLM0/SEMgcPcQ2Pr5qHyZgU3RpxRq7nJALnv5Rb8xmQuZZFR6/cIj672b2Afs6eysiJQxXKR48xP9SVqfQmwsJZG2MdSykwDRgAhlclsnP7NoDquw1w7ltmfFSYA5kgrq1yFay2sEIScqf9UKWjOXccffzN+Z+GCuoEP1OAnF7w0rsfSIoKoDx/7hVXLjBOzcoR5eWDrqwZh0zPaHzI+xJZ/ZjfCIuQl2XV5c0WkHEkzAEHTRP3N4Y9zMsiph9VoAOVYO+eb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JV3+tJsqS9ZGWoG+7Anbr4KjyZIcSQYyqeuhURuZaTXOyyBGrGxuIyrj+IXFkxbDCnaAObnFq4s3o9thlCIVNG9xLDBYpXBG59ozBA+ttwA9UJ9d7gRDsE6i3vJSoOJOMOOHBeyThz2T+wekKZMsRw8PTfJ8Yc4mhxNOgPbJitnx8ytkuLPprHfv0SoVhvRaedW/OJYZSLX34ysvNk/DQKkq3euhFGMn6zw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(9101521062)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001);SRVR:BLUPR0201MB1779;BCL:0;PCL:0;RULEID:;SRVR:BLUPR0201MB1779; X-Forefront-PRVS: 0923977CCA X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(377454003)(24454002)(92566002)(86362001)(33656002)(76176999)(65816999)(87266999)(54356999)(50986999)(19580405001)(19580395003)(65806001)(47776003)(2950100001)(83506001)(77096005)(5001770100001)(107886002)(3846002)(4001350100001)(586003)(50466002)(189998001)(230700001)(5008740100001)(6116002)(5004730100002)(23746002)(64126003)(36756003)(1096002)(2906002)(59896002)(42186005)(81166005)(65956001)(66066001)(93886004);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR0201MB1779;H:tpl2.home;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;BLUPR0201MB1779;23:zIVaWv5Qp/oQ7oy0eUtyP5Ww4wCOsIfmopg?= =?Windows-1252?Q?WhsbRxrnsF+YtdLvkql/CwgaPb7wHzC2uhTU9NmQQCq7vj2Prdt4MzpV?= =?Windows-1252?Q?uJURHXjzFvOhjOWEn3y+syw+dhL3TKnEtpP2S/bVytsNzHHMAbPGNc1h?= =?Windows-1252?Q?i5329+PXGg2R/h41vNTqQxSMy7Vj5QJ5XFGH2HDP5qlwsrGzywZPW+5h?= =?Windows-1252?Q?OCMgqxwWrl2PSZNcYF5qohfb7jrlDVosrJAl/08P3NUjyz4jn7ioqClO?= =?Windows-1252?Q?8ApKuhVJr7YdQUr8F05QmAChXdeVd+aXrP3UqfJDFa44vyhqynwNNE2I?= =?Windows-1252?Q?hfh3e3bzVkU4FzYLIOIgDOEbHLH+UEUEy9iGckM/oZ8skuyYfQRTgzB8?= =?Windows-1252?Q?pkHsgkdHNLHLW/Qgdx+ZBVMtqj6FmzpKYTVPZOgGfQUb3Ib9sZPyy11F?= =?Windows-1252?Q?/wzdUR8dN8BvbF9OxnWAXpqwoWGYTw5i9dRlmK4GhWehKIVUmjGj0Aup?= =?Windows-1252?Q?RpQa4Gq6aX7uHIsveg2wa+ngBKi4EWyxK0KYyhVifYiM+c4Rd9tGtxcC?= =?Windows-1252?Q?kZZ5e/PBSDT6alLluVaAUdQBGRtEYtsPgK6/YR282rCKxYtLiigtkAIu?= =?Windows-1252?Q?4Lp+cX3CHaceaKWeqEIuWMZjZlxqd7QkFEY7Tp45fjXfg4WF3vDgUzCM?= =?Windows-1252?Q?KHRsWtFylBAZj+70wYWrIuSctt2UWW/h6jQ1VfriW2/nk0R6vf0b+GQN?= =?Windows-1252?Q?FBWdHmAS9pmk3S1mSJtXWfpVt/VPRAB70YIZbMwCA3K1JAluMPqiJQSB?= =?Windows-1252?Q?UPLR62NmYh1lcjcLdF5jCdo5msh99GdytK+nIIKvpGQRZVPhTtGVdWR4?= =?Windows-1252?Q?K+Cw7Fw0LexfhCQq2gqqgy1at1cVV0ALv5+7ixjeDTIrQfZnGAKJGmuD?= =?Windows-1252?Q?j/ScxPRGsOpCZlXtbgV1TLjwWLvC/PEqQxEcvhPzLYZidwjx1lvfTq+H?= =?Windows-1252?Q?J6Un/wrpp4EI+VqGetDE6QJe2G+4lp3Rj1fMqD/5ABvL0QHrZ+5x+ez+?= =?Windows-1252?Q?5LpPGIwDaNQOaFGK7yjyCSFVsndsceF5Tvx/TPg9NclY0jsOk2jLOHyw?= =?Windows-1252?Q?JAaHL3ex6Y6vD3Y5AHCiU4cpgz4awLzd8OlhlEce30ZO+DpCXykx2Zi1?= =?Windows-1252?Q?OByhzoeF7fw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;BLUPR0201MB1779;5:P/IoKz74ASyPX4NqVbd5aP3GgPVnMJWpJoi1dULa7tQD5YE7ra4FERK83voVrmE+Em3WzuHYR7whoHaq5aq5O/zshM8IacHSeQJaGrJAyl/ypsawD7W5XhhaOmogBMs2ROcwWMPtF+A1eL/4JZHHaw==;24:9bBTcZsb9uh5XfNh3tbl6/lOCbAT++gYHK+eikL5BTtASdzC0+aHHGF9/sFzW7Xi6LTV71jaNVZXVItUhBiE1s9fGkG6yVdwYQXVS+sci6A=;7:h0zlia9FG2wQCcuQ56Kazu7n3ont4kVqc6FVsoMkhqCZFfhhdIXlQPECFBIYoyklgBPn7xyaWkyG5tBd1OitfS/UNm+qXIcOZKB0e2bMi7Xa3XgRMHhA6fRqyvHq4eHn5tg3PACj3bhoyY+jdQC0+fqSrGYBDCxcPHFHQ8YEktQ0Lv4mDAELxOS018fGpfpJ SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: zend.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Apr 2016 08:21:58.4576 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0201MB1779 Subject: Re: [PHP-DEV] [RFC] PHP Attributes From: dmitry@zend.com (Dmitry Stogov) On 04/24/2016 05:02 PM, Thomas Punt wrote: > Hi! > >> From: dmitry@zend.com >>> On 04/22/2016 02:46 PM, Thomas Punt wrote: >>> Hi Dmitry! >>> >>> Just a couple of comments on this: >>> >>> 1. I'd definitely reuse the php-ast extension for parsing the code into an >>> AST. It performs a number of transformations on PHP's underlying AST >>> that make it much nicer to use (namely better consistency). It is also >>> less fragile by having the abstraction between PHP's internal AST and >>> the AST that is exposed to userland (enabling for internal AST changes >>> without impacting the AST exposed to userland). >> I'm not sure. Both approaches make sense. > Whilst fragility is a concern, a bigger problem with not reusing > ast\parse_code() is that the AST produced will be different in even the > simplest of cases. For example, take the following simple expression: > > $a> 2 > > With your attributes branch, this will produce an AST of: > > object(ast\Node)#2 (4) { > ["kind"]=> int(521) // ZEND_AST_GREATER > ["flags"]=> int(0) > ["lineno"]=> int(1) > ["children"]=> [...] > } > > Whereas with ast\parse_code(), the following AST will be produced: > > object(ast\Node)#2 (4) { > ["kind"]=> int(520) // AST_BINARY_OP > ["flags"]=> int(256) // BINARY_IS_GREATER > ["lineno"]=> int(1) > ["children"]=> [...] > } > > The php-ast extension transforms the special node types for>,>=, <, <= > into AST_BINARY_OP nodes with different flags set. This is just one > difference of many between the internal AST and the AST produced by > the php-ast extension. This is initial implementation details, and they are going to be fixed. If we decide to use AST in attributes, getAttributes() outout are going to be 100% compatible with php-ast. > >>> 2. You mentioned about moving some of the php-ast extension into core. >>> I wonder if it would be better to just move the whole extension into the >>> core first, and then enable this functionality if the php-ast extension is >>> enabled. >> Even if we move php-ast into core (I think we will do it), it's going to >> be optional. >> However attributes should always work. > If we're going to reuse ast\parse_code(), then we will need the whole php-ast > extension in the core. It could therefore be made similar to the pcre, date, > Reflection, SPL, etc extensions, where it cannot be disabled. Right, but this is out of scope of this RFC. Nikita was going to propose moving php-ast into core soon. Thanks. Dmitry. > >>> Also, slightly tangential, but the RFC says attributes are supported on >>> class constants, yet doc comments (IIRC) are not. I wonder if support >>> for doc comments should be added for class constants? >> it is already implemented. > Oh right, my mistake. It does not seem to be exposed through php-ast or > reflection then. > >> Thanks. Dmitry. >>> Thanks, >>> Tom > -Tom