Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110410 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 94159 invoked from network); 7 Jun 2020 19:53:50 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 Jun 2020 19:53:50 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 77DA41804DC for ; Sun, 7 Jun 2020 11:37:04 -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.80.0.0/12 X-Spam-Virus: No X-Envelope-From: Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12olkn2036.outbound.protection.outlook.com [40.92.23.36]) (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, 7 Jun 2020 11:37:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QoBPxl2MQkCO717XLraUvyDfAnJC+UBpdS4IbH7yvrIkfooSNQzdL/aJhw9rQWqu1GSQz2AfO+QGRKLEvxOd2kSgA8r9GmTvVoCpmDIG+Gqhlomj8svgWwoQ7edGHHZhNGdiESfJCOQ3SRw1qPH40OH0RcuFyyyzKbWIWrjI6KdTxu04/L1MIFcZJcYy+p5I9nyiJ8TBreBBRI1nIWAAMGSvnyp31qT4SfAKFN+KslC9G63cg3V0e+zAtSsCDioJ50aUuA7d7fgCZTS6hXqKwGd+8wxTBf5Ippy9OVT08xgC4kcNd/YIqyfKaW5iEZbwkaElCNbyLxEAkPZzgzeJRw== 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=dd8XT7ziHSr88CNC1l9+xsK7ksg15leOtjsJiUlUeiE=; b=Ih+lQwGJ/7hmmSSNl+n/dmqUygNXFolGA7qk0A/aH8Trd3NMV2XfRWe9RRpUV+0t135JiYh8ZCft/r+2UL81CRda9OAYo7RrVQqFWdVIoVEd7xGjbjGHulJePZ/GzoGuoAf4Bi7cqz0vlFdaIN1wzTbU6wt/Z+0O7VgioOvhb+qPMpWF7PEZnKtDPFi1a+NoFvFN1PXKLQBe/hnuAzulnXJCt4vZm/A8AR0Uo15VbBB/ksLr6xzIncj1brPhvjCisBTGhSOhOlht07rcplcdiS5ms4wITNhmx8BunQtkr/zGiW+hFUnJ9Z+fDmvcttX+zzIgBMo3HE/kclLWml3J0Q== 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=dd8XT7ziHSr88CNC1l9+xsK7ksg15leOtjsJiUlUeiE=; b=APjQiSjMqT7E5cLyec1CFhrq+UpDAhowFjyuL12VSDVxSyn/pKqeJUN/l0pUvKjcZxFfTJUE/AXUFsH517tBISjrmPz6RWmoVkZYvfr0SpcUH2AGuoTKaIle72QVXGzmvIoY6keBAy73Kqj690lcJnv6Aiag3AAiNVl9UmpGPAlM/Yvmmd+8C30MBv29tvuFH4+fN3Ex6mo5eZBHfugVdaUwoXHXhvR7N1Kd8fdzyGHOXY0hVkesE3UHWfW4+2P0WpwooDjA+tUYbTFEPeNKKxYHRP7zvLyL2TpH8IwK+1avd2bhMc/oz9DkxKSvvwpKXsSb+BEG21rclkSDsvWecQ== Received: from BN8NAM12FT037.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc66::43) by BN8NAM12HT168.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc66::299) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.9; Sun, 7 Jun 2020 18:37:02 +0000 Received: from BYAPR05MB6535.namprd05.prod.outlook.com (2a01:111:e400:fc66::49) by BN8NAM12FT037.mail.protection.outlook.com (2a01:111:e400:fc66::128) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.9 via Frontend Transport; Sun, 7 Jun 2020 18:37:01 +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.3088.014; Sun, 7 Jun 2020 18:37:01 +0000 To: Rowan Tommins , internals Thread-Topic: [PHP-DEV] [RFC] Shorter attribute syntax Thread-Index: AQHWOgIv0rCwDWp4oECJgOMrWx9MxKjItJCAgABT1+2AAnlHgIAB4RWM Date: Sun, 7 Jun 2020 18:37:01 +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:835F7209A7D268AA7D2A0C35CA6D1BEFD8DE155D4BFC454861DD45945D091220;UpperCasedChecksum:0A4A476760A042D467306216A528EABF8B0D0EFBB9A5312DD057882F0089BAF7;SizeAsReceived:7110;Count:44 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [5W8Oylb+tfoK8ji9iojMerd1GPTmba1J] x-ms-publictraffictype: Email x-incomingheadercount: 44 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: ee7e886b-c0ff-4545-57d8-08d80b11c4ed x-ms-traffictypediagnostic: BN8NAM12HT168: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: EYBV1xrZZlcIdz1dlU8O59CdjbaIV+Tp2xV0/A0mjaPPf4ycN6fQmeUhktk/3q75ulTioNbHcPbnjofoOjs2B7qBoRbW2sttxdTgD2iVM9woFRg6dE5x2uuvN31tG35tTO04aVyoaeeL3e2hCaUUAQYhiZJjuc0OYD4WVNShu30JLS4bTLc5v1HI+u++v4vH7/0PukaHTOqAkyo+b6/0sA== 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: lsX7wn5VuobjlVdqEQZkl3t5PrxEIaUDH25q4iXGTU6jAVbdp3cFKL+OtEZSdZ2T5oXx6Mnxtm7cgrswVYlnJlQVu7pHVLUGj8Mvnbg+lZP5Uxa6zWvYihu461iJbaThWGYm+jPtt52Juy3kbeSjrA== 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: ee7e886b-c0ff-4545-57d8-08d80b11c4ed X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jun 2020 18:37:01.8424 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8NAM12HT168 Subject: Re: [PHP-DEV] [RFC] Shorter attribute syntax From: theodorejb@outlook.com (Theodore Brown) Hi Rowan,=0A= =0A= On Sat, June 6, 2020 at 7:06 AM Rowan Tommins wro= te:=0A= =0A= > The `::` token in the parser is called `T_PAAMAYIM_NEKUDOTAYIM`, and =0A= > personally I find `T_SL` and `T_SR` just as cryptic and irrelevant. The m= ost =0A= > common place I see those token names is when accidentally running code = =0A= > with conflict markers like "<<<<<<<<", or when messing up heredoc =0A= > syntax; even if they weren't so abbreviated, my reaction would be "shift = =0A= > what now?" I've used bit-shifts maybe twice in the last ten years, so =0A= > it's just not an immediate association to me.=0A= >=0A= > "Disingenuous" was probably too strong a word, but I do think it relates = =0A= > to a fundamental difference in viewpoint: to some people, `<<` and `>>`= =0A= > are first and foremost the shift-left and shift-right operators, and so= =0A= > the immediate association on seeing them is so obvious it's not worth=0A= > mentioning; to others, they just look like a new kind of brackets.=0A= > =0A= > That association might actually be a good reason to avoid that syntax, = =0A= > but if so it should be spelled out, rather than taken as a given.=0A= =0A= That makes sense. I updated the RFC now to avoid usage of "shift tokens"=0A= in most places and instead refer to them as `<<` and `>>` tokens. I also=0A= added a sentence spelling out why the association with shift operators=0A= may be confusing for some developers.=0A= =0A= Additionally, the RFC more clearly lays out the issues with nested=0A= attributes now.=0A= =0A= > > Also, grouped attributes would probably have to be special-cased to=0A= > > be disallowed in nested attributes, since they don't make sense there.= =0A= > =0A= > I'm not entirely clear how they work in current implementations like =0A= > Doctrine's, but I think nested attributes would have to have completely = =0A= > different rules anyway, because you don't access them directly through = =0A= > reflection in the same way.=0A= > =0A= > If `<> )>>` means something like `new Foo( new Bar )`, then I= =0A= > can imagine it being useful for `<> )>>` to mean=0A= > `new Foo( [new Bar, new Baz] )`. That would actually be more convenient t= han=0A= > the double-at version, where you'd have to write `@@Foo( [@@Bar, @@Baz] )= `=0A= > or use a constructor with a `...$variadic` parameter.=0A= =0A= In that example there are the same number of characters either way, so=0A= it's not clear the nested `<<>>` approach would be more convenient.=0A= And do you think it's a good idea to have an additional syntax for=0A= creating arrays like that? It seems like it could get confusing.=0A= =0A= > Ultimately, it all comes down to judgement calls - is the =0A= > double-angle-bracket syntax "too verbose", "too ugly" when nested, etc; = =0A= > and does the double-at syntax make it "better enough".=0A= =0A= Yes, I agree that there's a judgment call to make. Out of curiosity,=0A= given these shortcomings of the double-angle-bracket syntax, do you=0A= think there are any objective reasons to prefer it over `@@` (other=0A= than the theoretical BC break of code like `@@@really_suppress_me()`)?=0A= =0A= Best regards, =0A= Theodore=