Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110323 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 58754 invoked from network); 1 Jun 2020 01:06:51 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 1 Jun 2020 01:06:51 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5AC4B180211 for ; Sun, 31 May 2020 16:48:22 -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 NAM04-CO1-obe.outbound.protection.outlook.com (mail-oln040092010061.outbound.protection.outlook.com [40.92.10.61]) (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 ; Sun, 31 May 2020 16:48:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JKx6ZaBjzP8jILR6+U7xq5mRiXwTEmkAoxmvzcmFzix9Xw4rJ81+AGI5QYQz97tuFNEk300OXau4Af/3++sxej1+npVVaogJ9M7K31URw76Q0bui7QPMD2Gv36lpvwkQoqlSMQdrBqEZd7jksHsTjda0G7c8nqb2nKo04Vrk842Ifs+rdmoV1xkKM8N01Q48n9X+36ph9s3BBdj0ktv0xjJ+G/9OFviTvKkJDd5hwfRdghoXwn6ATr8ydY20kQlL0b5WnCFiyRAME5NOt14B3EnOqOLr5M/iLo7Pj0yzU/1OiWhZ4cmVG2TyONNVcniRJhsSRWtov+Gf9oOWNSoNFg== 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=EGVzwDctjUGcVdZacuthS+b8nZ7qaWSGkEj96loob10=; b=Gn1RLIt/qFzTGNsIzodGXErq7ICeCEldgwsnBiA5LfxJ2ojyrOINqZWwJbnK7OuBHSGH4fcB2axNDe5sFWBwl7+BXPgPxWJWI5Ten5FsVqG9jm3v+ZLTfWnnJg2A8V2q4C4VLck9mt0wdxcdYZ6zsDD5F7v9QjAU4TjXTwMj9B1PU1QZ6dC63q3OdjiQ0F5Jcj6EvfMyYTkkugTskh9XbTgO0LNQ3awVrnu2xJL4y14uJ3E1E3bNsPiBH9FRcUQ+LDtOF16bkJf57XR1kItY4JV3YAGmTkUg/KQEvvRRgKXlQtiCw5WHP/+KKqhJVT5D5d9rQUEMAxCidFPpLjv7WA== 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=EGVzwDctjUGcVdZacuthS+b8nZ7qaWSGkEj96loob10=; b=SQpNR32j1GG0d1fW4jSGsA3qJhgoKm5NYqX3Z8yGDlyex7AFRB2yWT7zuB/pHamwpktiuWs4JQ3ZJ/7NHKWeyCqcoNo4gPk9wu9Fkqjc5aT5euhUd7C6K61J5VGW/6b7H10ptPyi1dWnMFKi7aYP5WeoA3UrTndfoGitwwqstpML6WxbC3QXvhdlYqovzS3EtS/BLsPQtRe1sNfunqmsqwSMBV5wxeEZ/kl55FJap6bcZA68t0sVdvP1Y6bhJLRB+1Rdkf6TV5BmPwmJFkt/bbWRWkI7Vu0VfCK6DqGl1FAzg/GMjDtUL+wTSxrtIFrDMHP7jnAyq2sOrI6ztxK4Pw== Received: from BN3NAM04FT019.eop-NAM04.prod.protection.outlook.com (10.152.92.57) by BN3NAM04HT073.eop-NAM04.prod.protection.outlook.com (10.152.93.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23; Sun, 31 May 2020 23:48:19 +0000 Received: from BYAPR05MB6535.namprd05.prod.outlook.com (2a01:111:e400:7e4e::4e) by BN3NAM04FT019.mail.protection.outlook.com (2a01:111:e400:7e4e::173) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Sun, 31 May 2020 23:48:19 +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.010; Sun, 31 May 2020 23:48:19 +0000 To: Benjamin Eberlei , PHP Internals Thread-Topic: [PHP-DEV] [RFC] Amendments to Attributes Thread-Index: AQHWLslAmZDPs0th10Ou1V1jrsV2UKjC7E+B Date: Sun, 31 May 2020 23:48:19 +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:A4F2EFABEA5CE69612DFA9DE43CE677D9EF298426728EE9FB6E72BC52D88BC1C;UpperCasedChecksum:20FE0E0BDCE5157F7E2FADC9ECB8528F8F62F5A3E05DA38B7091CBA615719A27;SizeAsReceived:6950;Count:45 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [a/th4hy5+EC0w5CPfMHxAyFfS1YpAo1P] x-ms-publictraffictype: Email x-incomingheadercount: 45 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: eb50a141-59d7-433a-3fb0-08d805bd18b6 x-ms-traffictypediagnostic: BN3NAM04HT073: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: HF9ilaQz2pCi6KVxf0vUsMzlJnz4CEzL5fIIH3gdfeoTDeyDgocDPq7VPx9qV5NdXevQrosP2Plin3UfNr0davno8KNHfPBptXSkwdTxJkIQerj1nSVetppcoFVQ4vu77YruEZ+ciBbPlYRSuJwBbqRvlXvBw1qunGAlasMJBMjoWDcfCHOqsbPG7giX9TPfodwCXK6NDXxj8OniOQoVxXak16JDGEtjR4AHZTrQH6lCDPo1dT0dU5+nEK1tIo4L 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: WH1oGsnSR86iXwc9+AnIO2o7cz8+KHZ+Lybu+6S1afmxSBYbQXvMk7ZVPWm6yB/7gnuq3ExFw4cEzbfAsj5VP2kIe5YwUIaOitvIFL8IS/jJAXQHQpBIh92WgoXppOlC1ia6EYioxZUms3ZZ/M6XjA== 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: eb50a141-59d7-433a-3fb0-08d805bd18b6 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 31 May 2020 23:48:19.3550 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3NAM04HT073 Subject: Re: [PHP-DEV] [RFC] Amendments to Attributes From: theodorejb@outlook.com (Theodore Brown) On Wed, May 20, 2020 at 12:07 PM Benjamin Eberlei wro= te:=0A= =0A= > the Attributes RFC was rather large already, so a few things were left=0A= > open or discussions during the vote have made us rethink a things.=0A= >=0A= > https://wiki.php.net/rfc/attribute_amendments=0A= >=0A= > These points are handled by the Amendments RFC to Attributes:=0A= >=0A= > 1. Proposing to add a grouped syntax <=0A= =0A= Hi Benjamin,=0A= =0A= I find the grouped attribute proposal somewhat troubling. The RFC=0A= contains the following example:=0A= =0A= ```php=0A= <>=0A= public function test()=0A= {=0A= }=0A= ```=0A= =0A= The problem with this syntax is that adding a new attribute at the =0A= start or end of the list, or removing one of the attributes, will=0A= require modifying multiple lines. For some time the language has been=0A= moving away from this (see the various RFCs to allow trailing commas=0A= in more places), so this feels like a step backwards.=0A= =0A= If trailing commas are allowed in grouped attributes, you could=0A= write it this way instead:=0A= =0A= ```php=0A= <<=0A= Attr2("foo"),=0A= Attr2("bar"),=0A= >>=0A= public function test()=0A= {=0A= }=0A= ```=0A= =0A= But to me this still feels rather clunky. It requires two extra lines, =0A= and when moving from two attributes to one attribute (or vice versa),=0A= you'd still probably end up modifying multiple lines.=0A= =0A= Another issue with the grouped syntax is that comma separated=0A= attributes can be easy to confuse with comma separated attribute =0A= arguments. For example:=0A= =0A= ```php=0A= <>=0A= <>=0A= function bar() {}=0A= ```=0A= =0A= It can be hard to tell which line contains multiple attributes vs.=0A= multiple attribute arguments.=0A= =0A= Ultimately it seems like the grouped attribute proposal is attempting=0A= to work around the poor usability of the current verbose syntax. Maybe=0A= it would be better to instead propose a simpler syntax that avoids=0A= these issues. I know that some internals members expressed interest=0A= in an `@@` token, but this was never voted on.=0A= =0A= Having a distinct token for attributes would entirely avoid the issues=0A= of having to modify multiple lines when adding/removing attributes, as=0A= well as confusion with shift operators and comma-separated attribute=0A= arguments. E.g. the RFC example would look like this instead:=0A= =0A= ```php=0A= @@Attr2("foo")=0A= @@Attr2("bar")=0A= public function test()=0A= {=0A= }=0A= ```=0A= =0A= To me this would be a lot cleaner and fit in better with the rest of=0A= the language.=0A= =0A= Best regards,=0A= Theodore=0A=