Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111369 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 64779 invoked from network); 7 Aug 2020 22:51:33 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 Aug 2020 22:51:33 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B374C1804D1 for ; Fri, 7 Aug 2020 14:50:02 -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,SPF_HELO_PASS, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam07olkn2076.outbound.protection.outlook.com [40.92.44.76]) (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 ; Fri, 7 Aug 2020 14:50:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qp4N2YzNYnytildqMFkQW4M3BIUUfYdQDmbOwDUVg1Sx50YL1DJ0xQGHzj2XYVnC4aPqh5acHpMjaPVIzlydvvnIBNFWu924y9j7GVF+sOYasykCkqdWskjVjUtTne67+DKEMOjpeGeFh6WifUHunecxrgZB6kwWCcAr/CiInh/wfkaY1y8DTxka5HhywKNLE7vDd9q4F+MUzrVUQVXf3vOA3nqHzbaThY1Zx1kEc5g/wUvd4KWM/LyqNVKCHkNuk7Iyw0tlew6KocR3xqwlhSnyzz2z3D92QrIr+ieJbmUL/LGLrru5sP/46RvLKoIMsr8gqoXiPvyceDHW7KGBCw== 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=SrgSh6jrz6vg95zvNyQ81eGz0naZCqJZb58bMTqGHf8=; b=BcJAAk5xbX++g3xqNt4pRfYChXCrBNTwu7uATchldk9wlVcdWKHWH68dzhmpafRJZARtyYLCctBKmtsXleR9RUn+dBDBfQFQyuHqoiLneBsX+QenROsSxUsdzhRrBKyknM84DLnYjiDPD57DwTCZeRfdhxYbmeC5hs41U3SOJdkb17gdHXaqBYw0xl0mdjmpMG6JLPBtF1TD4gviLN2nR57lb16DLF5O/mpvWn81wUPVZAs4B77RcHg3e6X4Xv6jW7M1I+qiKEe5mhWzjWPy0bmxniC8zaYsDzSFw34tArq+QiXhDyjZpV7o5RPi+cciDDFJhCgoL4gzKDH7GxWLZA== 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=SrgSh6jrz6vg95zvNyQ81eGz0naZCqJZb58bMTqGHf8=; b=BF5V+QMW/AvY+/9jO8H6GeMW1IpvsbzYpVpk2cO+PFuYm17X4+VZGVjLeF16d5df8Al/jrblkp/I20tDFjG8XYU5Dndgt4qebTCnQCzF1i5p+rBLlV8rkRRbHNqQqZQoun1loWPGnNmDvcZXNYjPqUQTFfutCgWRU90Yx8Y5SNCI+dm7k/hGZH2D1654+W8G502GqrewPUM11YCbICcQLwnmdnmZU26B+iCJL36hkokb9Bb0GdxwDXHRHZvsfBgzr+WyaxNj3O58rK8HcvOkaFLU/X9vK16FUzh2+YbBkUkN2exrWDdZTJmgpNhGhpb0Equ9Jn5kbmwP1Izyg4ps1Q== Received: from BN1NAM02FT057.eop-nam02.prod.protection.outlook.com (2a01:111:e400:fc48::4a) by BN1NAM02HT041.eop-nam02.prod.protection.outlook.com (2a01:111:e400:fc48::204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.19; Fri, 7 Aug 2020 21:50:00 +0000 Received: from BYAPR05MB6535.namprd05.prod.outlook.com (2a01:111:e400:fc48::44) by BN1NAM02FT057.mail.protection.outlook.com (2a01:111:e400:fc48::165) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.19 via Frontend Transport; Fri, 7 Aug 2020 21:50:00 +0000 Received: from BYAPR05MB6535.namprd05.prod.outlook.com ([fe80::fc6c:38b0:fa18:f355]) by BYAPR05MB6535.namprd05.prod.outlook.com ([fe80::fc6c:38b0:fa18:f355%7]) with mapi id 15.20.3261.020; Fri, 7 Aug 2020 21:50:00 +0000 To: Derick Rethans CC: Benas IML , Rowan Tommins , PHP Internals List Thread-Topic: [PHP-DEV] [RFC] Shorter Attribute Syntax Change RFC 0.2 Thread-Index: AQHWamWKUBRwNDrYsUOzfoBQKi8o6KkoJexGgAKAW4CAAAhPgIAADw+AgAAJNoCAABvtAIAAbz82gAAHqACAAFtL44AAyxYAgACzlRE= Date: Fri, 7 Aug 2020 21:50:00 +0000 Message-ID: References: <20200806091749.64675445@mcmic-probook.opensides.be> , , In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:74CF2FFAECABA13E7263A6B3FAFCC25B65F15AB12F79894DAB2431E79732F3F8;UpperCasedChecksum:D941A36EC86BDD09B37D08C9F4EFE8EDE59AEB7205F6CDC3E3E504979C79D58C;SizeAsReceived:7824;Count:45 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [uKv0We1ugbHi5ZRmb9jQL+gvgICKQS6F] x-ms-publictraffictype: Email x-incomingheadercount: 45 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: 7ce0287b-83ea-41ee-f53c-08d83b1bd566 x-ms-traffictypediagnostic: BN1NAM02HT041: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: u7EHvaR1pXda/eIW34k06aTgOKdWw5A6/ZJTkUPV4HZidUKt7pRb2pdxakWrNm03FLGt4sWgsrBNmnbRC15GzsU+MYyoUffviW35IWKVY5p+bWk8xu6fru2/e2SzLsblnx9belrH4tXJCoakBs7+BHRNGx4tCU/hLlIakvv86necdEJ7XYZnM/DcfDmloCsAhVe1uDpzbKMKu8BfKLU+DnWbQ2w40ZvJ6vu2mFz2XJEC8dlcfo5CY16Di+Yont/f 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: gjqfBgVCfIJVMMxXz0Fn2Pq0Wgbsa7dNCUMAJMuRXAo0WKc01jw+d7hZXxT/EfoKCQCXvFXCenfooH6SwqQQigtyVi95EEFTgB9YGKUXjLX/kfq5WkVpvHPWVT9o6EYxGHw5u9aIEywNIQBS1n5K/w== 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-AuthAs: Anonymous X-MS-Exchange-CrossTenant-AuthSource: BN1NAM02FT057.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 7ce0287b-83ea-41ee-f53c-08d83b1bd566 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Aug 2020 21:50:00.2615 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1NAM02HT041 Subject: Re: [PHP-DEV] [RFC] Shorter Attribute Syntax Change RFC 0.2 From: theodorejb@outlook.com (Theodore Brown) On Fri, Aug 7, 2020 at 6:03 AM Derick Rethans wrote:=0A= =0A= > On Fri, 7 Aug 2020, Theodore Brown wrote:=0A= > =0A= > > Even if we assume the implementation is only about 30 lines, it's=0A= > > still extra complexity that I don't understand the benefit of. I=0A= > > sincerely would like to know what advantage there is of grouped=0A= > > attributes over the `@@` syntax.=0A= > =0A= > It was very *specifically* voted for:=0A= > https://wiki.php.net/rfc/attribute_amendments#group_statement_for_attribu= tes=0A= =0A= Hi Derick,=0A= =0A= It was specifically voted for the `<<>>` syntax, with the explicit=0A= qualification that "This feature would be superseded by any other RFC=0A= getting accepted that changes the syntax." This is exactly what=0A= happened when the Shorter Attribute Syntax RFC was accepted.=0A= =0A= > You still haven't addressed any of the deficiencies that the other=0A= > alternatives don't have:=0A= > https://wiki.php.net/rfc/shorter_attribute_syntax_change#proposal=0A= =0A= I'm not sure which deficiencies you mean, but let's briefly go=0A= through the table in the RFC to make sure nothing has been missed:=0A= =0A= - Number of required Characters:=0A= - `@@` has the advantage here.=0A= =0A= - Has End Delimiter:=0A= - This isn't clearly a pro or a con in itself.=0A= =0A= - Allows Grouping:=0A= - As discussed before, `@@` has the advantage of being equally=0A= concise without this added complexity.=0A= =0A= - Forward Compatibility in PHP 7:=0A= - This is at best a temporary benefit of `#[]` which will be=0A= irrelevant in a few years, at worst a source of confusion and bugs=0A= when code intended for PHP 8 runs on PHP 7 with different results.=0A= =0A= - Breaks BC of valid PHP 7 code:=0A= - All syntaxes but `<<>>` technically have a BC break. There really=0A= should be a separate line in the table for "Breaks useful syntax",=0A= since `#[]` and `@[]` have this deficiency, but `@@` does not.=0A= =0A= - Used by other language:=0A= - This is listed as an advantage for `#[]` and `<<>>`. However, the tab= le=0A= fails to point out that Hack is migrating away from `<<>>` to `@Attr`.= =0A= Furthermore, while `#[]` has the same start/end symbols as Rust, the re= st=0A= of the grammar/semantics vary significantly. E.g. these are valid Rust= =0A= attributes (see https://doc.rust-lang.org/reference/attributes.html):= =0A= =0A= #[rustfmt::skip]=0A= struct S {}=0A= =0A= #[clippy::cyclomatic_complexity =3D "100"]=0A= pub fn f() {}=0A= =0A= This is quite different from PHP's semantics, so it's not clear that=0A= copying the same start/end symbol would really be a benefit for us.=0A= Also note that unlike PHP, `#` does not start a comment in Rust.=0A= =0A= - Familiar with Docblock Usage:=0A= - `@@` has the advantage here once more.=0A= =0A= - Tokens used:=0A= - This isn't clearly a pro or con in itself.=0A= =0A= - Changes the lexing of **remaining** tokens:=0A= - This is apparently a con for `#[]`.=0A= =0A= =0A= Ultimately I think `@@` does the best job balancing a very small BC=0A= break with concise, familiar syntax that can cleanly support nested=0A= attributes in the future. And since it avoids the need for attribute=0A= grouping it also has the simplest implementation.=0A= =0A= Kind regards, =0A= Theodore=