Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111619 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 6542 invoked from network); 18 Aug 2020 23:02:22 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 18 Aug 2020 23:02:22 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6C4EE1804C0 for ; Tue, 18 Aug 2020 15:03:35 -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-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12olkn2071.outbound.protection.outlook.com [40.92.21.71]) (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, 18 Aug 2020 15:03:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CdZ34f2qRfJ91GCx2iU4IQpxawYDklPiHDaCsU25oVUBzkVAPZUOfGNch8g1io+LL1OCiIN0j2rhVI+xKLRErUrgvd6TbQPsjlt0odPG8pyC3knI8xC2JsimVlsRK7QuyhJaw4fpJBl0U2XDlOHXSymHVXQmwWwF4/YZYPzANgw9yUvM5Y2i3DBNEqfIeosN0miLrOFuuy6+VbDaW3oqLnWmsrEq5UMGKBiw9xARLqoR/h77M6Bn4wCnqMdjy4JNYcWlqUiNzVTR2g9f7vrBxNgmX/twqr0lAqdsOAWEpFDFkrx/w9d/c8mUkAFqNZR05E77jUZ6Jt27rmEwsGd18w== 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=OpwcLA1oo3jYzUquKBll7EIR7XMlI2Zv5sRHksNHKjQ=; b=jVyaM2LTvtw0xzKIo6hy5pfKnoeUYU4FETNOucHQ0AXJLqqU0pDK7QP0JbXsy+1wo8pBtiAmVsri5XNRYDI8BVMZovK2xjV9M7iuh20iNB97G70Y8xdt6w9l9jWc76A//Bg6HxwSV798+nV0sBHj2RfZoLrQI3R25u+Q29mZehjX7SD51A/qrZ2zfKfJWA/txtEImjFDpNWLKzgVpBUUGXHimZcn9stNPzjUYESYPgnx9gz2xdOXbiJ5B3axKupAmQ7X58hlp5OQoOnwNn/WSpw1mmefZjNqOQDhz8AfCqLMAEaiNZ98qgUoJ5fTvb2/mbwFtsDTayv3muID2FefNg== 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=OpwcLA1oo3jYzUquKBll7EIR7XMlI2Zv5sRHksNHKjQ=; b=TOe3omN9PZbomKpADe6QVbYd7cuROP1atUWp6PSTy5M+rbS1OwHDOR4sfwNgst8Y8Ferz/PkwAT+rrWdyLkRA81O+HltfmvQq81g+ot8YF/zfW3H1yFlrpFRK6PuVTbMfUPkoE8+K+k4AXR/LKZxBy1AxOJoaGJYVzuGCX4PEpd22hhthMAZwTI/K9mGsvk+KIZIpjSQYnEObSjfYfYAtyY8ysAL2BQRpdM7hpZFXRe103vnAejWP459TWL1t3+2Xu9Y41eyLDZlv2w/U9Zy4+lqVCVo6ZayF5eG5dWxHhw+k792ZTGIJbpW9ucH/eS8yaFxQgknVZsr326Vyi+V2g== Received: from BN6PR03CA0021.namprd03.prod.outlook.com (2603:10b6:404:23::31) by BL0PR2101MB0994.namprd21.prod.outlook.com (2603:10b6:207:36::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.5; Tue, 18 Aug 2020 22:03:32 +0000 Received: from BN7NAM10FT034.eop-nam10.prod.protection.outlook.com (2603:10b6:404:23:cafe::73) by BN6PR03CA0021.outlook.office365.com (2603:10b6:404:23::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.24 via Frontend Transport; Tue, 18 Aug 2020 22:03:32 +0000 Received: from BYAPR05MB6535.namprd05.prod.outlook.com (2a01:111:e400:7e8f::4c) by BN7NAM10FT034.mail.protection.outlook.com (2a01:111:e400:7e8f::151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.24 via Frontend Transport; Tue, 18 Aug 2020 22:03:32 +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.3305.023; Tue, 18 Aug 2020 22:03:32 +0000 To: Benjamin Eberlei , Derick Rethans CC: PHP Developers Mailing List Thread-Topic: [PHP-DEV] [RFC] Shorter Attribute Syntax Change RFC 0.2 Thread-Index: AQHWamWKUBRwNDrYsUOzfoBQKi8o6Kk+PgmAgABAhfw= Date: Tue, 18 Aug 2020 22:03:32 +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:4127824ECCAA92F6F809E6E489EB3CF4CEC30A7FD3B0836811A7F47060BE3BDD;UpperCasedChecksum:B792FE4CE73B5AC7E0A1EFB9272A4AD49C02A9B403A480C6CAB9E42CB8804A78;SizeAsReceived:7074;Count:45 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [hgawkfV9VkMjqrQ8ahn8IYgaQhDlqGTG] x-ms-publictraffictype: Email x-incomingheadercount: 45 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: 31cd79dd-317c-4673-49ad-08d843c28c26 x-ms-traffictypediagnostic: BL0PR2101MB0994: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 2qVUaOuQtu49Z+1Q1Tdw0FSa+b78AZDcfpFQSzlTdg8gmk4lZIyQhYB0hKqw+vj50UpI14mLNsytsZitXlfPAEBOJWpR0NMsBFuG7waUuSIE1JPn7kb0Ud18mAv0V3AQMkVYoRpAaBZe3g5fHY5C/9zc7nNR646yElMPYsEYIU+lVoUukT+10KarovJXp89+K531H7Qx+1oc2EmKclHkq9u0zL6j8xsNwtBQtwKBFkD0Pz02/KM+ipcO6PYA7uT+ x-ms-exchange-antispam-messagedata: ohcdPJ4UEnEw2BzkJm9y2knEojwVtRbKYsrPUdFu0ppfGILpgtRiWIeA+n1e/vjPp5Qb08IW85YUlow3TzL/bWpqQkXWJ3ew6i68uA4k7/Updb0hRJnLWJX/alQ4qHsLuufBIMnaLX7Z35n1s0oeeQ== 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: BN7NAM10FT034.eop-nam10.prod.protection.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 31cd79dd-317c-4673-49ad-08d843c28c26 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Aug 2020 22:03:32.5531 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR2101MB0994 Subject: Re: [PHP-DEV] [RFC] Shorter Attribute Syntax Change RFC 0.2 From: theodorejb@outlook.com (Theodore Brown) On Tue, Aug 18, 2020 at 1:00 PM Benjamin Eberlei wrot= e:=0A= =0A= > https://wiki.php.net/rfc/shorter_attribute_syntax_change=0A= > =0A= > I have updated the RFC one last time with as much of the feedback=0A= > as possible:=0A= > =0A= > - a section about comparing to complexity of type definitions=0A= > - removal of the machine reading section as too narrow and =0A= > ultimately not that important as downstream libraries just have to=0A= > deal with any of it=0A= > - some more nuances in forward compatibility pro/cons section of #[]=0A= > - smaller corrections and improvements.=0A= > =0A= > I don't think something major is missing now.=0A= =0A= Hi Benjamin,=0A= =0A= Thanks for the updates. I just have a few more thoughts on aspects=0A= that haven't been mentioned before:=0A= =0A= 1. The **Attributes are not like Modifiers** section makes an=0A= argument that having an end delimiter "groups docblock comment and=0A= attributes into two similarly shaped syntax blocks that prefix the=0A= declaration increasing familiarity."=0A= =0A= In my own (admittedly subjective) opinion, an end delimiter on=0A= attributes actually increases confusion when there is also a=0A= docblock. To reuse the example from the RFC:=0A= =0A= /**=0A= * A comment describing things.=0A= *=0A= * @psalm-suppress SomeRule=0A= */=0A= #[=0A= ORM\Entity(),=0A= ORM\Table("baz")=0A= ]=0A= final class Something {=0A= }=0A= =0A= Because the attribute group has its own start and end delimiters, it=0A= almost looks like the doc comment applies to the attribute block=0A= rather than the class.=0A= =0A= With the `@@` or `@:` syntax, it seems clearer that attributes are=0A= part of the class/function/property declaration, rather than their=0A= own standalone construct which docblocks can be applied to:=0A= =0A= /**=0A= * A comment describing things.=0A= *=0A= * @psalm-suppress SomeRule=0A= */=0A= @@ORM\Entity=0A= @@ORM\Table("baz")=0A= final class Something {=0A= }=0A= =0A= =0A= Given that the only complex part of an attribute is the optional=0A= argument list, which already has its own start/end delimiters, I=0A= ultimately don't find the "complexity" argument very compelling for=0A= needing an additional attribute end delimiter besides.=0A= =0A= =0A= 2. In the **Discussion on grep'ability** section, the RFC says=0A= "Enforcement of same line is also not the case for other=0A= declarations that benefit from grep'ability such as classes,=0A= functions, constants and so on in PHP already, so this is not=0A= consistent within the language."=0A= =0A= This seems to be outdated information, based on Martin's original=0A= patch before the "Treat namespaced names as single token" RFC was=0A= accepted. In the current `@@` implementation, there is no single-line=0A= enforcement, consistent with other parts of the language.=0A= =0A= Not having whitespace between the attribute token and name would be=0A= enforced by coding style conventions, just as is the case with=0A= function/class/constant definitions.=0A= =0A= Note that there is some precedent in PHP for choosing syntax that=0A= ensures easier searching (for example, the decision to place return=0A= type declarations after the parameter list rather than before the=0A= function name).=0A= =0A= Grep'ability isn't a big deal when finding usages in an IDE, but=0A= sometimes there is a need to search code on a server or other source=0A= without an IDE, in which case easy grep'ability can be very helpful.=0A= =0A= Sincerely, =0A= Theodore=