Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106147 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 20175 invoked from network); 5 Jul 2019 04:30:27 -0000 Received: from unknown (HELO NAM03-DM3-obe.outbound.protection.outlook.com) (40.92.8.30) by pb1.pair.com with SMTP; 5 Jul 2019 04:30:27 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nxH5F/W9ksqS7gb/vbyxNhT1wssoI06VgJW/ynsY3xk=; b=orYAioyBwXJdpCQuE26oAT0wpqgSRf3XYtZd6a4HJyseAZasYCwjQEJfIjptxhtodvRX9yIpE+OjyLD3RT6PMJ8HgXlWUoYGeg13RZlobWc2HSQ/e6X32jLt8Jk4G0U+iTtwc4impMEUxmVffFkir96YwPYO8o3Gokq5CM4VjbfDX82tUFkTsn9h+s+HfUJY6GR/Uyhi3dN06aDlcUIo0mFOqHj1gRSIngh2DAgsw/MalsFaEygmqSCtApvvE3X7eHoBgOs0XJcYr2aaiu66FaYu/QYigXOaCtTmErN6SIgxCdyIskHxUxz/kTloRmqZg9sxPoO+PAMZOqUO4+ZPMQ== Received: from BY2NAM03FT063.eop-NAM03.prod.protection.outlook.com (10.152.84.52) by BY2NAM03HT010.eop-NAM03.prod.protection.outlook.com (10.152.84.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2052.18; Fri, 5 Jul 2019 01:48:58 +0000 Received: from DM5PR06MB2857.namprd06.prod.outlook.com (10.152.84.53) by BY2NAM03FT063.mail.protection.outlook.com (10.152.85.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2052.18 via Frontend Transport; Fri, 5 Jul 2019 01:48:58 +0000 Received: from DM5PR06MB2857.namprd06.prod.outlook.com ([fe80::48cd:8998:c8ff:1f79]) by DM5PR06MB2857.namprd06.prod.outlook.com ([fe80::48cd:8998:c8ff:1f79%9]) with mapi id 15.20.2052.019; Fri, 5 Jul 2019 01:48:58 +0000 To: =?iso-8859-1?Q?Bj=F6rn_Larsson?= , "Andrew Gromov" , Peter Bowyer CC: PHP internals Thread-Topic: [PHP-DEV] [RFC][VOTE] Deprecate curly brace syntax for accessing array elements and string offsets Thread-Index: AQHVMYirNfxB7kSeak+vM8JqgzmjCqa5A+gAgAIIBgCAADeX9w== Date: Fri, 5 Jul 2019 01:48:58 +0000 Message-ID: References: <1562149108.866677.18420.33348@mail.rambler.ru> , In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:9D1C94F77771F90AEE61029856533A6A46BBC3FC4A2E488A269A153E89C57EB7;UpperCasedChecksum:0C7C8B253233A86DB096A264CAB8D05B7FB3A90E91333DE8440085A25E130D58;SizeAsReceived:7095;Count:44 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [RE9edfzoZB0ZIkNMqX6Qy/DRYH+OcGUx] x-ms-publictraffictype: Email x-incomingheadercount: 44 x-eopattributedmessage: 0 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(5050001)(7020095)(20181119110)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031322404)(2017031323274)(2017031324274)(1601125500)(1603101475)(1701031045);SRVR:BY2NAM03HT010; x-ms-traffictypediagnostic: BY2NAM03HT010: x-ms-exchange-purlcount: 3 x-microsoft-antispam-message-info: Xd5am4UaF/tsRHAGaeEyTh6aImeqpUlNQ+e7UHRJDbnKVSdfcMSRD9EQ3Ck1z8PR4VO51SAR7TXg8j/NajJnwQ0a5brRrRao8Gs9N4I2zXkszowPMf5hBsFhhcHEjtpkH8r4mflRjCWw8trdbN0RX5FMBZ0az4afd2DLPgnxd8nxNYBDCs+V6vBQjJCB1n56 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 571ad8f7-4668-4525-e16e-08d700eaf228 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jul 2019 01:48:58.0146 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2NAM03HT010 Subject: Re: [PHP-DEV] [RFC][VOTE] Deprecate curly brace syntax for accessing array elements and string offsets From: theodorejb@outlook.com (Theodore Brown) On Thu, July 4, 2019 at 5:26 PM Bj=F6rn Larsson = wrote:=0A= =0A= > Den 2019-07-03 kl. 17:25, skrev Peter Bowyer:=0A= >=0A= > > Thanks for taking the time to push forward this RFC.=0A= > >=0A= > > I found the earlier discussion at https://externals.io/message/104744,= =0A= > > which I hadn't seen. Like others, I would have chosen to keep {} for=0A= > > string offsets to make it clearer, though I have not used {} in my=0A= > > code for a decade. Was any consideration given to a split vote,=0A= > > voting on the array and string deprecations separately?=0A= > >=0A= > > For others interested, the history of this deprecation going back to=0A= > > 2005 is found at https://externals.io/message/38153=0A= >=0A= > Hi,=0A= >=0A= > I have the same question regarding split vote. In my eyes the=0A= > array case is a no-brainer, but for string access maybe not...=0A= =0A= =0A= Good question. I did consider whether it would make sense to only=0A= deprecate curly brace offset access for arrays and not strings. The=0A= problem with this is that it wouldn't solve the issue of confusion=0A= outlined in the RFC.=0A= =0A= Unless the bracket syntax for string offset access was also=0A= deprecated, users would still be left to question whether the curly=0A= brace syntax behaves differently in certain circumstances, if one=0A= alternative performs better than the other, if there is a scoping=0A= related difference, or when the curly brace syntax should be used=0A= instead of the normal bracket syntax for string offset access.=0A= =0A= =0A= > Would it be possible to compare the string access only for both=0A= > curly & straight braces and the same for array access?=0A= =0A= I updated my script to list all the unique variable names referenced=0A= in the output of Nikita's analysis of the top 2k Composer packages:=0A= https://gist.github.com/theodorejb/ba35fc8f72df8823e07c5f3b51870e00.=0A= =0A= The most frequent variable name is `$string`, and from numerous other=0A= variable names it does seem that the majority of curly brace usages=0A= are on strings (other frequent variable names include `$code`,=0A= `$Bytestring`, `$chrs`, `$text`, `$str`, `$numberstring`, and many=0A= similar examples). I also dug into the repositories for a bunch of=0A= the packages, and most of the curly braces uses appear to be in older=0A= code without any type declarations (which may explain why so many=0A= variable names include a type).=0A= =0A= Best regards,=0A= Theodore=