Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127358 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id AD6F61A00BC for ; Wed, 14 May 2025 15:38:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1747236995; bh=v9k4zOzvA3cdp+cSdZN+OuL73a58x/WoWcP6lfybfs0=; h=Date:From:To:In-Reply-To:References:Subject:From; b=md2UTCMZwjkldIjD+0nvQ9IeVIglbfhHnHqU6H9NotR7p7/BmxSuNGztlQ+mez3ty GSebKQ2KUCNcuIioipZRkNM1AYDYBzUdRKjLrpN9yD51XfxV7DoSH2k0U5P2udrcAZ actxivNSKIcdRr1EorQMGwuUXDcBy/tCyeQSaXS0oEBl3wqlGUuO5Oo5Yxaq2CjyOp M2CrOAX3EnL8yDq/c418pj7OTubt0EuY123mYoFtO4rr2E/X/hoAmjX70JLCZ/u/xe wggr0WqqLs7+NkXXuqf2npy2Fli5aBsIo4ubQE3YWro9WUdi0apwHRTJmfAzPb8edU 7+++96qvosHGw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C5EA01801DB for ; Wed, 14 May 2025 15:36:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from fhigh-a3-smtp.messagingengine.com (fhigh-a3-smtp.messagingengine.com [103.168.172.154]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 14 May 2025 15:36:23 +0000 (UTC) Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfhigh.phl.internal (Postfix) with ESMTP id 26B6E11400B7 for ; Wed, 14 May 2025 11:38:34 -0400 (EDT) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-10.internal (MEProxy); Wed, 14 May 2025 11:38:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=fm3; t=1747237114; x=1747323514; bh=1OL425ko9CqE0LWtUF8V9 JWcakQVXWqVix485daqo2g=; b=ddokAh0DW72HttDzDxN19KywzS5bp1XAAKbGu im6bee3gxeloPJ1mhF8r6Y9ppU/y9X69u4nbh1p0CvJra8XBGAu8zP0U6Z6ZgZqP Wc6y2TB3m/IbO/2bbpxxS1jrnqv2urnBtWwFtTOp6XyX1xGNaQKAMq2WGnxJLvTz vaRVPTpRr2ueeTNzc/K4VehyXmyQE7D9P/RopTcXy3dN5ljmIeP6AjzBaNY6ELwK fShp1pZwBNzGREWmWwtIKd0316p5/Nl0/JbVFiwH7sqP0+YYLzL/WDMVg13KzpRI P/rrKFcP7y5kUj3E4+RGbSbEas+FIaQ6JUm8TzeTXAzTJL7MA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1747237114; x=1747323514; bh=1 OL425ko9CqE0LWtUF8V9JWcakQVXWqVix485daqo2g=; b=Y3uMA5LQmtlbxI59b wNIRFmV/9f81wi3vEx/dLvv/lpJyv0FzDMRwgVNYJ/J5ILKJImqcIrH3+6NxzAIJ UoPpLySZu0EnlYklHXnc/VjhfrdPiEeTPxNpa0H7xL8BydG6EG2gfTUxnoZwYazE SNEI6EUulIIT+X2lnUlnnM+Jqz73pla6Gt2IFzMcJK/Wm+YU3s69FHHY311L5Xmi q0pQ8un5O3ejT09uiu3IYmMqYJcm8wRqJLW46zulfsDpTn8aHRP35xzTMWN2oD19 YtiVFNJ4FO/NvrC3XLNMr8uYnHabVn0PcVIsxvB4dda6qOmS7RhvWsrFEmjmZzWB VIYRw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdeftdejfeeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhepofggfffhvffkjghfufgtgfesthejredtredt tdenucfhrhhomhepfdfnrghrrhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrh hfihgvlhguthgvtghhrdgtohhmqeenucggtffrrghtthgvrhhnpeelfeefleevvdffueej gfegveevgfdthefhveetgeegfefftdekvefhveegvdehudenucffohhmrghinhepphhhph drnhgvthdpghhithhhuhgsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghr rghmpehmrghilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmpd hnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehinhht vghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 8B1B4B00069; Wed, 14 May 2025 11:38:32 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: T11f5e8d0f54ccf80 Date: Wed, 14 May 2025 10:38:12 -0500 To: "php internals" Message-ID: <533ea02a-dd69-4de9-8526-f808c5a9f4a1@app.fastmail.com> In-Reply-To: References: Subject: Re: [PHP-DEV] [RFC] Clone with v2 Content-Type: text/plain Content-Transfer-Encoding: 7bit From: larry@garfieldtech.com ("Larry Garfield") On Wed, May 14, 2025, at 8:04 AM, Volker Dusch wrote: > Hi internals, > > A couple of weeks ago, we stumbled over the fact that the original > "clone with" RFC was abandoned and thought it would still be useful to > suggest a trimmed down version of the proposal. > > The main goal of this RFC is to propose a lightweight, low friction > implementation of this feature to satisfy the couple of use cases we > see and "round out" PHP in how it handles cloning, especially around > read-only-properties. > > https://wiki.php.net/rfc/clone_with_v2 > > We are actively looking for some feedback on > https://wiki.php.net/rfc/clone_with_v2#open_issues, but of course all > points are welcome. > > If this turns out to be more complex than anticipated, for some reason, > specifically around syntax or BC implications, we'd rather not add this > at all. > > A preliminary implementation that shows how small the change set needs > to be exists at https://github.com/TimWolla/php-src/pull/6 > > Kind Regards, > Tim and Volker As discussed off list, I really like this approach. It's definitely cleaner than the earlier versions. > A magic __clone() method will be called before the new properties are assigned. Why before and not after? I could probably make a good argument either direction, but we should be explicit about why we're making whatever decision. The last example, on readonly, is a bit confusing. It looks like it should work, but the comments say "but if we did this other thing we'd get this error." Just make it two separate classes and show one works and one doesn't. That makes it easier to follow. > Alternatively, we could drop the variadic syntax and instead only accept an array as the second parameter. We're looking for feedback here in the discussion. Oh lord please no. :-) Not using an array here is what I like about this syntax. An __object parameter is fine with me as a workaround. One shouldn't be using a named argument for that anyway. --Larry Garfield