Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111368 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 30694 invoked from network); 7 Aug 2020 13:43:07 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 Aug 2020 13:43:07 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0094E1804DB for ; Fri, 7 Aug 2020 05:41:31 -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 NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10olkn2021.outbound.protection.outlook.com [40.92.41.21]) (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 05:41:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zk1j3SV979Y8LOrMHaVQ6x06IZAqqse3/8XiTpmFWHhA7+gaxATPcatqAZDwJOHJiDVGofgpCn5Wko2fJvrSjm22w28qAvO8A1hMDSDaFZJhU7Q1L12WpxeJEeeu+zBHAS503uUQrFowU5C/AXMtSp63K3Udfpo8PnfMVVz61TbTF8phkpPM1kXibWol0NxvKH0WerAjWMatYzjcn+3wOvIyjSfRWnIbs+dflxhH99rFqdHfsT3mcL5gLzDRn0NwX8g0FIwC+dV5CIyC5fvN4ISEohBQT3Sn2vRU2OeXg26LHd+6fIrN4IavoGsvrd1NigXAxZ3ZE5kW+USfTIiXQw== 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=SOr+dNI0UCEUiHs3VHpeVTFaKNLzQBqbDhYUEisZT+A=; b=kx3OKetpCOQoKddgmngNM6ONfYqnm/pG3QYQH0FcFQStQR/JkNVnGYIGx2gHTO37tYRPNsDcMPMfIGYnefLapcLHczawnxHbrrvthXESzVmrlfxDzCDmePe8MNA14niYNu0LUt1/qjssvoz1YVY0MmyrgyNwTlr8cxYQvGd3OWX+iBwllgFqzvBQ03UjXrDntePCOuFo1pw6DDUincYjuatVG2SMUaA0ON/eYxi1ttb4csiYxvTWMgQIZm7YFKm3tqXaRm8+seScKNgSOBxVwgK/ASkO/2kYvAtn6po8DyuRXeLzSKiw2fLHp6+xUu8Ih/zyjUzAs8Em0V2cANZNnw== 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=SOr+dNI0UCEUiHs3VHpeVTFaKNLzQBqbDhYUEisZT+A=; b=hlBW2xKJhl3KmAXiL8wTxVWIBPQvE7X9xJ6z5xw28sWgjpmJOSkbdsImlhVumb12zPuV87eLmF3hrSsQvlakRTFSR3q7YDldi5YTizd6FfQsXqI44Xrionq5Vaq4hdmXT1ReyVe1WJk8mqKi78sDAmpuL+CFp244jgtsjRr2WCDPrCtKxm4SKMjsMoiQN7uGYtJi9xMQBP+YFbUOMM+vygrxrE9fiq3dczjlNROe2MB89GyYEC1FQCB8BkB5KttME1M/fMOBFp72n0muwA+egTvnSeJ5dpDOAxiCZLvZsn0vP5iJqyrXMwmsRi9A09OjINtWnpn6YuRsUj3ZeRezUg== Received: from MW2NAM10FT051.eop-nam10.prod.protection.outlook.com (2a01:111:e400:7e87::50) by MW2NAM10HT139.eop-nam10.prod.protection.outlook.com (2a01:111:e400:7e87::331) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.16; Fri, 7 Aug 2020 12:41:30 +0000 Received: from BYAPR05MB6535.namprd05.prod.outlook.com (2a01:111:e400:7e87::45) by MW2NAM10FT051.mail.protection.outlook.com (2a01:111:e400:7e87::227) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.16 via Frontend Transport; Fri, 7 Aug 2020 12:41:30 +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 12:41:30 +0000 To: Benjamin Eberlei CC: Benas IML , Rowan Tommins , PHP Internals List Thread-Topic: [PHP-DEV] [RFC] Shorter Attribute Syntax Change RFC 0.2 Thread-Index: AQHWamWKUBRwNDrYsUOzfoBQKi8o6KkoJexGgAKAW4CAAAhPgIAADw+AgAAJNoCAABvtAIAAbz82gAAHqACAAFtL44AAoLyAgABE5mU= Date: Fri, 7 Aug 2020 12:41:29 +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:D4934A248E9DD328E1B4261F702D1C5B67CBFC051C52F43C16066EAB46BA9383;UpperCasedChecksum:44819DF52756E6F02DBE7E623EB7293CAFB186B6D3BE1C6CF7AFE551631A9332;SizeAsReceived:7826;Count:45 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [JhAPqPBVBGmnTdxf29uxyPqX1HG4a2/8] x-ms-publictraffictype: Email x-incomingheadercount: 45 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: b239158d-f57f-492e-cb36-08d83acf3552 x-ms-traffictypediagnostic: MW2NAM10HT139: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: cbC96ZJy5DLdHdIuxELJZiDIgKH4Vkj36OrcVP5aT0dP9+HPapsGxd4bI3tyB22V0e0ClJe4U12xosYYpMrpURmxhXHjymbIb/aFsJzFd7UEcS8tw0+fcTkTgIrn9h/nsTZDmVAIyk00ybeb/X58VSnt8uYa0qkIXRn3EkXQuPRsylK7UbZKaTbjUo8QLDCdZJAHJEEPjV9AC6SILMoRIcyHdzxJW2vjB3kvj6+Je2GG9xT/3B5pf8/q9fkowkte 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: QXqQHTD/1+lbyzmr1fKZIyTgnbYb21+jKIfaSIms1LtSdpWGxl3MHPeL0aJ67NYxJZ3ndeveEVtmm+qwDeiFu9guAxdKAub9NrzsPxbNNDe192FQ/FMisVcelxZcOGSR1y3HpwrBQ5OFG+W20fs65g== 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: MW2NAM10FT051.eop-nam10.prod.protection.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: b239158d-f57f-492e-cb36-08d83acf3552 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Aug 2020 12:41:29.9615 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2NAM10HT139 Subject: Re: [PHP-DEV] [RFC] Shorter Attribute Syntax Change RFC 0.2 From: theodorejb@outlook.com (Theodore Brown) On Fri, Aug 7, 2020 at 3:32 AM Benjamin Eberlei wrote= :=0A= =0A= > On Fri, Aug 7, 2020 at 2:24 AM Theodore Brown wr= ote:=0A= > > On Thu, Aug 6, 2020 at 12:30 PM Benas IML >= wrote:=0A= > > =0A= > > > Hey Theodore,=0A= > > >=0A= > > > On Thu, Aug 6, 2020, 8:05 PM Theodore Brown = > wrote:=0A= > > >=0A= > > > > While none of our syntax options are perfect, I believe @@ has the= =0A= > > > > best long-term tradeoffs because:=0A= > > > >=0A= > > > > - It doesn't break useful syntax=0A= > > >=0A= > > > Fair enough.=0A= > > >=0A= > > > > - It is equally or more concise than grouped attributes without=0A= > > > > adding complexity to the parser/compiler=0A= > > >=0A= > > > Are we really going to debate that ~30 lines of code add complexity?= =0A= > > =0A= > > Hi Benas,=0A= > > =0A= > > I don't know how many lines of code it will be, since an=0A= > > implementation for it has never been finished. The patch currently=0A= > > linked in the RFC does not implement it.=0A= > =0A= > Curious what brings you to claim an implementation has never been=0A= > finished when it was accepted by RFC vote?=0A= > =0A= > Grouping certainly has a finished implementation, Martin and I had it=0A= > working for the original RFC, then when we removed it for the original=0A= > vote had a working patch and PR as part of the Amendments RFC.=0A= =0A= Hi Benjamin,=0A= =0A= Apologies, I didn't realize the grouped attribute implementation was=0A= completely finished before. When it was dropped from the Attribute=0A= Amendments pull request, a bunch of other changes still had to be=0A= made before it was ready to merge, and I assumed that some changes=0A= would have also been required for attribute grouping. Thank you for=0A= the correction.=0A= =0A= > I now ported the patch to the @[] syntax PR here: [updated link]=0A= > https://github.com/php/php-src/pull/5928/commits/597688fd5b0a41d23028454b= 62ba25f950f35a16=0A= > The zend_compile.c diff looks a bit complex, but it's really only 5=0A= > new lines for a new for loop over the groups and all existing code=0A= > one level deeper.=0A= > =0A= > All in all the attribute grouping patch adds 26 new lines (and then=0A= > tests) all restricted within the existing attribute parser rules and=0A= > the functions compiling attribute code. This adds no complexity at all.= =0A= =0A= This is some new complexity, even if only a small amount right now.=0A= My question remains about how much more added complexity it will=0A= require later if we implement extensions like nested attributes.=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 is equally or more verbose than `@@` in real-world use cases=0A= > =0A= > You keep bringing up verbosity like our primary language design goal=0A= > is to reduce it, PHP is the most verbose language I know. Everything=0A= > in PHP requires more characters than in other languages. Keywords are=0A= > usually long, variables need an extra $ in front. You have to use=0A= > $this-> as no implicit context exists. Functions need to be prefixed=0A= > by "array_", "str_" instead of methods on the objects.=0A= =0A= Yes, PHP has historically been rather verbose in some ways.=0A= Thankfully this has been gradually changing, with the short array=0A= syntax added in 5.4, and more recently short arrow functions,=0A= constructor property promotion, and the match expression having an=0A= explicit goal to reduce verbosity.=0A= =0A= > The primary design goal of a language construct in PHP is not to=0A= > reduce verbosity.=0A= =0A= What is the goal of the grouped attribute construct? I still haven't=0A= received an answer about what makes it better than `@@`.=0A= =0A= > > `@@` avoids the need for additional complexity, special cased syntax,= =0A= > > and having to modify extra lines when adding/removing separate=0A= > > attributes.=0A= > >=0A= > > > > - It is conceptually closest to the docblock syntax the PHP=0A= > > > > community is familiar with=0A= > > >=0A= > > > Well, if `@@` is similar to `@` (to me it isn't), we can say that=0A= > > > `@[]` is also similar to `@`.=0A= > > =0A= > > I would agree that `@[]` is more similar than `#[]` is. But arguably=0A= > > `@@` is still the closest since docblock annotations don't require=0A= > > being wrapped in array brackets.=0A= > =0A= > But docblocks are wrapped in /** */, enclosing the whole declaration=0A= > of them.=0A= > =0A= > Both @[] and #[] are comparable with /** */ as metadata **boundary**.=0A= > The attribute itself has no symbol prefixes or alike, it's just the=0A= > class name.=0A= > =0A= > This is a very close translation to how docblocks with userland=0A= > doc-params work, in my opinion this makes all enclosed syntaxes much=0A= > more in line with existing syntax, regardless of symbols used.=0A= =0A= Aren't docblock annotations only wrapped in /** */ because they have to=0A= be inside a comment? There is no need for this with the native=0A= attribute syntax. To me, the `#[]` and `@[]` tokens don't at all look=0A= similar to docblock comment boundaries, anyway.=0A= =0A= Best regards, =0A= Theodore=