Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111324 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 94295 invoked from network); 4 Aug 2020 17:39:09 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 4 Aug 2020 17:39:09 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A0940180562 for ; Tue, 4 Aug 2020 09:36:51 -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-Virus: No X-Envelope-From: Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12olkn2092.outbound.protection.outlook.com [40.92.22.92]) (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 ; Tue, 4 Aug 2020 09:36:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mbTV5a6cgWvUE8elwyCmBiGbMGKKDwH7cblp04GhtOAQ7L6QwN17HoBHN25+JXgBeoRzxbn4Dpzr4zK+Or2emm7dRK3R+NFkj7cIkXc+gzgY7HRaTcc0KN8YOpNhlTlAO+LIwoSyAVKmRm/PrTm868JoO3tR/JWKN5bBj33oGNQBNcNV4VGM+AEH1QC3cG48LkP9bL7koh7qGPLEOPpCNnX7c1pIXlIzcY6/CVUsL7fvPDQ2PnxGRa3XKyKp5ZXWS9oLAYD3SfZDteV+fn81DVZBlkYVKKJccZrKifNZKgTUhZcX+Lxr0v2mTVgSz7OujF+2g+0BNuw5YwiGCDl1EA== 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=gWCBTWWF7sMmdKej0KvUWdyupesrZotQ+P+TmARdpC4=; b=NUmZ3c7G7rwYbbrUpqqDoGIrb7ZH4A2sVYi1TChkT3WsU92oKvzFhIQcuNzxivojIhXDQZPSvUI0AlkTZr58oP2JeQmUpt8Z7TYWfpvEPQxJ17Bbz4ret08b08IGiCBbNSHxrd2s00oToTNiVqIoBBlAw1VoXFUVqg6eREDL85WbPE3/QYvKdRtAfxv0s+44lk1rJxErd9xiJmbR6fr596HUBEek72KQRXYGb0enR40WAkun4i94WH0i0DnAJizh4/DXgJy28KK8y6pE4qdJJkY3p+zs4td1Am4lLU5c7hL7ylOOrcBL4W71iaJTr97IDaJUrVAXg+umEsxt/ygnKg== 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=gWCBTWWF7sMmdKej0KvUWdyupesrZotQ+P+TmARdpC4=; b=I/xIQ7yjBXL16bZBZwbazsW5GRl9u9STFKs0TCPewRnep/9+v6dElUsNlcHrRchNytBYKQjIVlFSzLYlqq76NaXPEpvqxRw278IDAajE8zcewwQXJFr6WHcpSnaVik4Q+QwbPY21q0wScpgtgrBYnWckL/HTrLMm+SZmo37d+aB3YI9e5RUwFRXWKNH4ZgXT9aWoePRqerde1pHI8E7SqHIEnRNsarPhMtt37PgYjb7WGm4cBixkvL26M1qrR7uIdm9naDRr+lwNG1ViBQCVtKlWSSvttA6Upe2TRA3rQcIDDP+QHeqduFgrhSeQ6YhOyoxDUTopack8a+bIb49dZQ== Received: from DM6NAM12FT063.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc64::40) by DM6NAM12HT169.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc64::312) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.10; Tue, 4 Aug 2020 16:36:50 +0000 Received: from BYAPR05MB6535.namprd05.prod.outlook.com (2a01:111:e400:fc64::4a) by DM6NAM12FT063.mail.protection.outlook.com (2a01:111:e400:fc64::112) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.10 via Frontend Transport; Tue, 4 Aug 2020 16:36:50 +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.015; Tue, 4 Aug 2020 16:36:50 +0000 To: Derick Rethans , PHP Developers Mailing List Thread-Topic: [PHP-DEV] [RFC] Shorter Attribute Syntax Change RFC 0.2 Thread-Index: AQHWamWKUBRwNDrYsUOzfoBQKi8o6KkoJexG Date: Tue, 4 Aug 2020 16:36:49 +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:5C206CCC68E1EED13B564B39E12BDF78A248C136EF7A00DF1287F0DF3F85F681;UpperCasedChecksum:3A8D6A9DCB3EA0B7B95C8A5A92A7794FCAF0B3BF24B40A36113FB3D1AF061455;SizeAsReceived:6936;Count:44 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [nTJ4axhB9KZ434WjLDuXcQh50h3k5Vy/] x-ms-publictraffictype: Email x-incomingheadercount: 44 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: c4ff41aa-978f-4cf0-0842-08d838949643 x-ms-traffictypediagnostic: DM6NAM12HT169: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Yx060fQjtPJmyMjwakSnwmaHNOTFjscaB9AX55RwDbcGfg1QWAsrJYC2lRZuQMk2A6QWryMGMlegzm/HU6jFX0gd21iLOuNLJaEAdnlIT7nhwPGzZIAAh+RetpgvlITbukH0VDhX8Hsp4j39OyFA7DUvsUTcCgiFbELBh6ao8pgm4YYT2EPIQmPwG0L0a7TYYzSkeR0C1jESe9IVEm8cePIyBsCsfG0emiPcrIE8UI+6FkEUECJIyAqBRg1LSDAc 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: Jm5Zvv8DZbvqR1uwkTPklTKDCUwuRY6DtLcs5Hw2ETIYjAdRPAD/YeOyszkHsM92Dpgjh688WkXPkG3BbA8B1ziRV3K5+/JH17QD0RWJ5ufcb5EPGRFlYeYp41+NNa61Jqly7VDT9uY14Q7rn6/MnQ== 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: DM6NAM12FT063.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: c4ff41aa-978f-4cf0-0842-08d838949643 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Aug 2020 16:36:49.9856 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6NAM12HT169 Subject: Re: [PHP-DEV] [RFC] Shorter Attribute Syntax Change RFC 0.2 From: theodorejb@outlook.com (Theodore Brown) On Tue, Aug 4, 2020 at 8:45 AM Derick Rethans wrote:=0A= =0A= > Out of Banjamin's suggestion[1], I've updated the Shorter Attribute=0A= > Syntax Change RFC to reflect that process:=0A= > =0A= > https://wiki.php.net/rfc/shorter_attribute_syntax_change=0A= > =0A= > Patches and comments welcome.=0A= =0A= Hi Derick,=0A= =0A= I don't agree with the main argument put forward in this RFC:=0A= =0A= > The main concern is that @@ has no ending symbol and it's=0A= > inconsistent with the language that it would be the only=0A= > declaration or statement in the whole language that has no ending=0A= > termination symbol.=0A= =0A= Attributes are not a standalone statement or declaration; they are=0A= metadata *on* a declaration. They cannot stand alone, but always=0A= modify the following declaration, just as public and static modify=0A= a method, or a type declaration modifies a parameter or property.=0A= =0A= Modifying declarations (e.g. for visibility and type) do not have an=0A= ending symbol. For example, we don't write something like:=0A= =0A= [public] function foo([int] $bar) {}=0A= =0A= With the @@ syntax attributes a treated consistently with type and=0A= visibility declarations:=0A= =0A= @@Jit=0A= public function foo(@@Deprecated int $bar) {}=0A= =0A= So there is nothing inconsistent about not having a termination=0A= symbol - this is in harmony with visibility and type declarations in=0A= PHP, as well as the attribute syntax used by a majority of C family=0A= languages. [1]=0A= =0A= When it comes to supporting attribute grouping, I actually consider=0A= this a downside of the #[], @[], and <<>> syntaxes. It complicates=0A= the internal implementation, and makes it so developers have to=0A= choose between two different syntaxes when adding more than one=0A= attribute. In real-world use cases the @@ syntax is just as or even=0A= more concise without the extra parser/compiler complexity:=0A= =0A= #[Attr1, Attr2] # 15 chars=0A= =0A= @@Attr1 @@Attr2 # 15 chars=0A= =0A= # 4 lines, 53 chars not counting whitespace=0A= @[=0A= AttrWithParam("foobar"),=0A= SomeOtherAttr("fizzbuzz"),=0A= ]=0A= =0A= # 2 lines, 52 chars=0A= @@AttrWithParam("foobar")=0A= @@SomeOtherAttr("fizzbuzz")=0A= =0A= I agree that we want the best syntax, not necessarily the best=0A= **looking** syntax. I still believe that the @@ syntax offers the best=0A= balance here. It's familiar, concise without additional complexity,=0A= and doesn't break useful syntax the way @[] and #[] do.=0A= =0A= Kind regards, =0A= Theodore=0A= =0A= [1]: https://wiki.php.net/rfc/shorter_attribute_syntax#comparison_to_other_= languages=