Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120193 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 5098 invoked from network); 5 May 2023 15:31:30 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 5 May 2023 15:31:30 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 07AEF18050B for ; Fri, 5 May 2023 08:31:30 -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.3 required=5.0 tests=BAYES_05,SPF_HELO_PASS, SPF_NEUTRAL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS30827 82.113.144.0/20 X-Spam-Virus: No X-Envelope-From: Received: from xdebug.org (xdebug.org [82.113.146.227]) by php-smtp4.php.net (Postfix) with ESMTP for ; Fri, 5 May 2023 08:31:29 -0700 (PDT) Received: from localhost (localhost [IPv6:::1]) by xdebug.org (Postfix) with ESMTPS id E8FED10C401; Fri, 5 May 2023 16:31:28 +0100 (BST) Date: Fri, 5 May 2023 16:31:28 +0100 (BST) To: =?UTF-8?Q?M=C3=A1t=C3=A9_Kocsis?= cc: PHP Internals List In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-166287723-1683300688=:41807" Subject: Re: [PHP-DEV] [RFC] [Discussion] Clone with From: derick@php.net (Derick Rethans) --8323329-166287723-1683300688=:41807 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE On Mon, 17 Apr 2023, M=C3=A1t=C3=A9 Kocsis wrote: > Hi Everyone, >=20 > Quite some time after mentioning the "clone with" construct the first tim= e > (at the end of the > https://wiki.php.net/rfc/write_once_properties#run-time_behaviour section= ), > finally I managed to create a working implementation for this feature whi= ch > would make it possible to properly modify readonly properties > while simplifying how we write "wither" methods: > https://wiki.php.net/rfc/clone_with | So far, all =E2=80=9Cclone with=E2=80=9D examples introduced in the curre= nt RFC used=20 | fixed property names which were referenced as identifiers followed by=20 | a colon (:), while the values to be assigned were expressions. | | =E2=80=A6 | | both side of the assignment is an expression, separated by =3D> I don't think there should be two syntaxes here. Either allow=20 expressions on the left side of the ':' or always use '=3D>' and require a = string on=20 the LHS. The example already allows for using a string on the LHS in=20 {"foo" =3D> 1}, so I think that the most useful choice. I don't think in=20 {PROPERTY_NAME =3D> 1} , the LHS should be interpreted as the literal=20 value PROPERTY_NAME, but only the value of that constant. cheers, Derick --8323329-166287723-1683300688=:41807--