Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110453 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 83181 invoked from network); 9 Jun 2020 17:13:55 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 9 Jun 2020 17:13:55 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id DEDF01804F8 for ; Tue, 9 Jun 2020 08:57:38 -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=-0.7 required=5.0 tests=BAYES_05,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 NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11olkn2037.outbound.protection.outlook.com [40.92.18.37]) (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, 9 Jun 2020 08:57:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Nx05DD8P6+Egp5w419EYaLbZsPl2pHNpS2N6FJao8kmR7dtLCtbVObYq5gKb52xVFUZJCokAY7JrPQ35F3vGgmhqR3RGz23FOaZ/nn8F+0R31Hu0Q0R1WSy+0KDkWZDgxeIgJmI/TtlznFQsaHOYODFPkOTNCt37SdNBYkNXU/n+4SBUQQ6JdPX81qiVFW+kEhyq30MxrH3Nw0s9KCSrjuzpV/T6YMqpbn1t2Gu06C/kD6KgxccoprP7D/c0kgXHttwuSq6LL/kP3lE30w63EjMKVGv3p5hy3tXoz8MF5oowyjrWR72JK0rLJ8JGpZ8pOER87ZVzjLSleQnw6HhgvQ== 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=gykpa8JuvUKxKP+dOsBz0jftQXK+KqLECZ2HeVaFxqg=; b=fkamUmkOAj6qEVoetKo5ejJRhkyOy80vHMiGT2op0X+0nF0/ZsAqjKO9GOn9oe0ukJOnVk1bv9sVy7px0pQ/7bgTNuJ3/l5YfUucCUtOxZC7X02gcriNonivckzdP+wGIwX9nS9vw+rIg2h73TzGwqeBz/f+iAmDLV7Xokg6Zdo/3/2DJ7DBEVq9c64FJL83PcVzYRnpvcojl9eCxPBgTUPHZ66oOt+0AkLzKeMTDb8bQppc/+KiJgVj4UilAEdZ9vqnVPjOENfkISLTEoOzgeS/FiP9LpDeTVqpgjAn63U3PhfXo6szvHdKdv8J/wvYBL8uF9Ng21fiI67RMMUCag== 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=gykpa8JuvUKxKP+dOsBz0jftQXK+KqLECZ2HeVaFxqg=; b=coCaI5DXIJMZwJvEJACgDMshf1a6TEv3KFfozz9XWhqyHajj0fWTXwjUOqZQ3vuLwzYXBZe4c3LAMFLJUml+JRS0EfV+knzcADZ+7k9/mMAwAvNcoCjMXHcLDn4KjwaP6dkrgsyJeNOauGxODytCoXpXeTY7+CI509Y9h2pA/ogVcnF9T77FlIRoocbCfSZNHne5eXPu/CIZt7W1GWdN+4+LVWdd4tmwOWmo53sFK2sjitv5uGo39fWtK0m8XWHIU5h+47wxvqWINfSSBw5TMc/tDOkfV94fxebArce+JXeh/CGaut4EjKPxChz1fjd+f1wtqD2STfrUZ4Epd2+KNw== Received: from CO1NAM11FT046.eop-nam11.prod.protection.outlook.com (2a01:111:e400:3861::48) by CO1NAM11HT213.eop-nam11.prod.protection.outlook.com (2a01:111:e400:3861::80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.18; Tue, 9 Jun 2020 15:57:36 +0000 Received: from BYAPR05MB6535.namprd05.prod.outlook.com (2a01:111:e400:3861::53) by CO1NAM11FT046.mail.protection.outlook.com (2a01:111:e400:3861::203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.18 via Frontend Transport; Tue, 9 Jun 2020 15:57:36 +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.018; Tue, 9 Jun 2020 15:57:35 +0000 To: Benjamin Eberlei , Sara Golemon , "carusogabriel34@gmail.com" CC: internals Thread-Topic: [PHP-DEV] [RFC] Shorter attribute syntax Thread-Index: AQHWOgIv0rCwDWp4oECJgOMrWx9MxKjQNb8AgABDMVA= Date: Tue, 9 Jun 2020 15:57:35 +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:E4F07E562C085B6DA582863AE7E99328321604CC3ACFE7252C487A4830198BEA;UpperCasedChecksum:427E521917676BA51A93A2147C1FD9237E810A41B6CDD78D8AF336EB36B48B75;SizeAsReceived:7056;Count:45 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [oN/z2OnRomG80O+yb2Pld6hS9qJ2BZKw] x-ms-publictraffictype: Email x-incomingheadercount: 45 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: d7fa46ff-f85f-4ca3-b4f4-08d80c8dd3f6 x-ms-traffictypediagnostic: CO1NAM11HT213: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 6qpyB0erATTog8ULPEMlKVOdTsPbSSQKnU/ZJQ1I89QbfnvSaiwt61tIFYZ9VeT6Fk2Memfpg83lkYzYjaYwwgop1qKAF6QBOofBWQriSYiLv4zBJzj0OXj+OH8sRlz9gjeUKO4GzfhEFwRZg8EY0ZwIjnutuWFtx4U4PBkVKbNlmJicoLuHVxc1H5U+oxN7mxGfU02vh/8rZhll8/Ud1g== 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: /nbNXA04BftdgQgkE+ubr4KuUo99iJpmk88Bqw4fT5zSp5FpWn6UO9iWNTGWzsrrkNgtT6yjsKvWPPj8okTI59V52SgGn3J2ET6epTY/LlNBxxopKoE2CjZJRWiHMtIfjT2oe6JqBS0DlVyKm3AZYw== 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: d7fa46ff-f85f-4ca3-b4f4-08d80c8dd3f6 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Jun 2020 15:57:35.8218 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1NAM11HT213 Subject: Re: [PHP-DEV] [RFC] Shorter attribute syntax From: theodorejb@outlook.com (Theodore Brown) Hi Benjamin,=0A= =0A= On Tue, June 9, 2020 at 6:55 AM Benjamin Eberlei wrote:=0A= =0A= > Larry's suggestion about `#[Attr]` makes an important argument about=0A= > allowing to declare attributes in code in PHP 7 in a forward compatible= =0A= > way that has not been brought up before.=0A= >=0A= > ```php=0A= > /** @ORM\Entity */=0A= > #[ORM\Entity]=0A= > class User {}=0A= > ```=0A= >=0A= > This code would work on PHP 7 and 8.=0A= =0A= That's an interesting argument. After thinking about it more, though,=0A= I'm not sure I understand what the benefit would be. The docblock=0A= annotation needed for PHP 7 is *already* forward compatible with PHP 8.=0A= So wouldn't this just be duplicating the attribute and opening the=0A= possibility for them to be out of sync for no benefit?=0A= =0A= Rather than duplicating attributes, wouldn't libraries simply stick=0A= with docblock annotations until they need to depend on other PHP 8=0A= features anyway (e.g. union types), and then switch completely to the=0A= native attribute syntax?=0A= =0A= Furthermore, even if there was some benefit to having an attribute in=0A= both docblock and native syntaxes, it seems like this is a very short=0A= term concern. In a few years once libraries are depending on other=0A= PHP 8 features, will this even matter anymore? So I'm really not=0A= convinced that this forward compatibility argument should influence=0A= the syntax choice.=0A= =0A= > The `#[]` syntax would have about equally low breaking potential as `@@`.= =0A= =0A= Is this really the case? There's no benefit to adding extra suppression=0A= operators, but I have seen code in the wild using hash comments starting=0A= with an opening bracket (e.g. to comment out an array, or for making=0A= checkboxes like `#[x] Some comment here`).=0A= =0A= > As such, instead of going through each alternative syntax one by one,=0A= > with with each having a 2/3 requirement to overthrow the old one,=0A= > I would be open to restart the secondary vote on Attributes syntax=0A= > with `<<>>` (status quo), `@@` and `#[]` using the same ranked voting=0A= > algorithm that was used for the PHP 8 RM vote.=0A= =0A= I'm certainly open to holding a three-way ranked choice vote like=0A= this, if others are okay with it.=0A= =0A= > I would take on the work to write about the third syntax alternative=0A= > then. The VoteRFC could just link to the three individual RFCs where=0A= > each discusses their syntax.=0A= =0A= I added a section to the Shorter Attribute Syntax RFC discussing the=0A= pros and cons of the `#[]` syntax. Let me know if you feel it isn't=0A= worded fairly. I think it would be preferable to have the syntax=0A= choices and voting options presented in one document rather than=0A= spread out in different places if possible.=0A= =0A= Best regards, =0A= Theodore=0A=