Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110369 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 17908 invoked from network); 4 Jun 2020 13:57:27 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 4 Jun 2020 13:57:27 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 219D71804C2 for ; Thu, 4 Jun 2020 05:39:54 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS8075 40.64.0.0/10 X-Spam-Virus: No X-Envelope-From: Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12olkn2058.outbound.protection.outlook.com [40.92.21.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 4 Jun 2020 05:39:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d1KLYS3vI3K0nVzulhaz1m213scwPjqJTU0yDe9UC7qQjmJS/52SZA/+umwXQktBTXonNBYtxE20fFXRdjiom16iBpqCCnLAgHmIidjxMqhYp2DdIku8X2BWoK6B4WZfl46LEoQzmvNY0UcSQQw8KfiU/OgwCbIBF3z0rBKUFrTO14baacmuPNgOvnaaPhtwr4KYYrGEDuRQXuZc4GpJh+TMyb2cLpmXHIS4FcB6WlJPxOgpiC3kWaNVYSWX32WFXwiiwjB1lOIvQY8ez8hroatnwiQ7EKBN/YOqN/YSki8gi+NUhTageLWwy65rOFv6zyXneicNlzPzgJiLc1FzIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=w/LzM5hn9uJcmUCEgBVa6lWZ1VPLIGMPk8oUuwBqr3w=; b=c0yT2quEisCMJLZ9XmIXnbEyJ9Zqf0BdB33Q5Pj6rS/paltdsAe5dvG2TPzZMbr9qRmyn8uHz27BvXIcPQxXlpODF5TZoNvLy10zE1nELIm4MXmyHV/zanjzzQVAW/atkLW4dd/IVrnJYfrBhoj9k4GxUQTB3/+b5YQtci0j1PtY4BE+8jgojeUq7Zy/Zegl01CWwjYZqy7VbamfmhuPIW2wSCsOIk12/qLyvQai/3sxcmnOVqNykf/5A0UI+TjQKcd+U9QyTk/cXHYHNHC1KF/NmTfTuMbpwILyd4JgLrUJ+223yk2Ah0PmpHS3yn2ArIrA8ENzBSG0czWok+4W4w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none 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=w/LzM5hn9uJcmUCEgBVa6lWZ1VPLIGMPk8oUuwBqr3w=; b=ZO2EJs+7lsOTpsndBBDqvFVTx9ONi7AJLcc6ezz4OTQ9hUbmS1KG1iqggdfheYIRN7WBMqZjd/UMrVOvnqD8B9FEP8dzx0Cw8QLWVPL/K+tw5TLqR/0E21ZDjOh94ufrhs2wL9H+qo/TtfGC5dfCpe0opR36nZrYTcw8oFgswU6Z2Qs77LJjWoQPP1j5EUcpeQREG8U+vRsn4RZAfqyNucIguSMPHv04VT4nBUzrMCpHUDZjBrCXzoARQwL86XwfXvztW7aQkOpLZR4tQnTdfoDO50jV+cwaQhnuT9HfzmFLmVGjXsj9w+ATyRqKow81M/3E544Kfhcgq5xFWinAww== Received: from BN8NAM12FT018.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc66::43) by BN8NAM12HT256.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc66::97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.9; Thu, 4 Jun 2020 12:39:51 +0000 Received: from BYAPR05MB6535.namprd05.prod.outlook.com (2a01:111:e400:fc66::46) by BN8NAM12FT018.mail.protection.outlook.com (2a01:111:e400:fc66::347) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.9 via Frontend Transport; Thu, 4 Jun 2020 12:39:51 +0000 Received: from BYAPR05MB6535.namprd05.prod.outlook.com ([fe80::54e2:1eeb:fc5d:8c21]) by BYAPR05MB6535.namprd05.prod.outlook.com ([fe80::54e2:1eeb:fc5d:8c21%3]) with mapi id 15.20.3066.016; Thu, 4 Jun 2020 12:39:51 +0000 To: Ilija Tovilo , internals Thread-Topic: [PHP-DEV] [RFC] Shorter attribute syntax Thread-Index: AQHWOgIv0rCwDWp4oECJgOMrWx9MxKjIGQcAgAAH34CAACNJAIAAIYOe Date: Thu, 4 Jun 2020 12:39:51 +0000 Message-ID: References: , In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:3DE37FBCB84948751A702725472481E1B486FF229D324DB75218CDE5787BF83D;UpperCasedChecksum:FF3D7E397D0E54AC6EA3D6F21519D92BBB59154B8335D8467166A71965E7678D;SizeAsReceived:7188;Count:45 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [1MLS3ctSeXu+CkF3t9tFY96jJs3Rm7RK] x-ms-publictraffictype: Email x-incomingheadercount: 45 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: 7248094c-8c51-43ad-cf38-08d808846054 x-ms-traffictypediagnostic: BN8NAM12HT256: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: t8EX8X9fxcwm2HCbdTDg+YdYK9X4KRuLHAnHG6sB34slyDEVmWv6AGSSq5/qwHGTqbOjhRxqe2ZdE/eerBWITnYc7M9neOnMRqSelh9QQmuEtSUhWc9/yDv32loXlTn0OkxALRYrM2xQQ+k9M3rjXpiXsSxEZ4TeBcrZLiTBWwOSAxaA+2w21oDiIJDwoOX8sbWmdaEFDBW9miZ/P0ZtyA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:0;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR05MB6535.namprd05.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:;DIR:OUT;SFP:1901; x-ms-exchange-antispam-messagedata: 6Iih3Yc9TbDGMjoA4H/HmPKkW7mcnFDgYLKUSKK89tcQXG+xrPeBUl/08NXJR6WjkA8UqohAMWZPn7J17KwnI6H7YhWgjZFJM1j4Um6YYgDdR8PoZ6ZVpFgRrc6iolnv8oOn3iCxFs/axmWSxBAeiA== x-ms-exchange-transport-forked: True 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: 7248094c-8c51-43ad-cf38-08d808846054 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Jun 2020 12:39:51.7261 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8NAM12HT256 Subject: Re: [PHP-DEV] [RFC] Shorter attribute syntax From: theodorejb@outlook.com (Theodore Brown) On Thu, June 4, 2020 at 5:37 AM Ilija Tovilo wrote= :=0A= =0A= >>> Does the PHP parser prevent us from adopting #[attr]? I presume=0A= >>> C#'s [attr] syntax and C++'s [[attr]] are impossible due to=0A= >>> PHP's short array syntax.=0A= >>=0A= >> yes, that would create ambiguity in the parser since `#` (just=0A= >> like `//`) is for comments.=0A= >=0A= > I've mentioned this off-list before. If we consider @@ with a BC=0A= > break we could also consider #[] by making #[ a symbol.=0A= > This is also a breaking change but a probably similarly small one.=0A= > It would break code like this:=0A= > =0A= > # Comments still work=0A= > #[ <-- But they can't start with #[=0A= > =0A= > To me both of those look acceptable but #[ looks nicer (but that's=0A= > just my personal preference).=0A= =0A= Hi Ilija,=0A= =0A= From the perspective of looks I don't have a strong preference=0A= between them. There are two main reasons the RFC doesn't propose the=0A= `#[]` syntax. First of all, I would consider this a larger BC break=0A= than `@@`. Although hash style comments are relatively uncommon, some=0A= codebases do use them, and I don't think we can presume to say that=0A= it "isn't useful" to begin a comment with a `[` (as can be said about=0A= using multiple suppression operators).=0A= =0A= Secondly, the `#[]` syntax is 50% more verbose than the two character=0A= `@@` proposal; Rust is the only language I found that uses three=0A= characters for its attribute syntax like this.=0A= ```=0A= =0A= Best regards,=0A= Theodore=0A=