Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127627 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 E45A71A00BC for ; Sun, 8 Jun 2025 19:15:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1749410020; bh=22BFGeblH/+pNr9BUx8bcKpIOxqVtTLPY8Wm0e4NDhE=; h=Date:From:To:In-Reply-To:References:Subject:From; b=Qa5QsiQApuBAtH9aPBGVxstl6AUjAH/vCPmIsfkzuOEh+tZCUvQyl2EkA/1Z7kmjW aIL0SVGcDc9pYegb2/LwDOhouxQeE3SeqvZBEfvI1OGh5Ej46rJ1ggkGsre4fF5Igr jlUjKsL2D3l2mb0idBPwN0l4fKAOH16L1cZiqutaErv1IrQihjmW256Y3BHN0+iWMQ UnjloMVSDQEJC/3H5zV/0yA6HmG4koxPoKf4Di+YQmOjnQ7bSogMU+cM80b9C12HoX gauFdE5LgzHK0f1X2KR3f1YrJAZj62KkB3g2d0EtFxkFZxSWByqdphofxHkOip4mYV Vksgb3eDiNwrQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8AD6418006A for ; Sun, 8 Jun 2025 19:13:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from fout-b8-smtp.messagingengine.com (fout-b8-smtp.messagingengine.com [202.12.124.151]) (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 ; Sun, 8 Jun 2025 19:13:39 +0000 (UTC) Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfout.stl.internal (Postfix) with ESMTP id 11D221140151; Sun, 8 Jun 2025 15:15:41 -0400 (EDT) Received: from phl-imap-05 ([10.202.2.95]) by phl-compute-05.internal (MEProxy); Sun, 08 Jun 2025 15:15:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bottled.codes; h=cc: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=fm2; t=1749410140; x=1749496540; bh=N4xWZtWA9z O8XOXoy2lJKNlwTczjTpnqEXgALk1cLyc=; b=HSW3WltPgmEfm/yi9/rntnypDx XfNGsly1lWUry1Jgf7YBZCHlnJDp7QaM1hs4+yyLh/4hg6ntRqRU7x/ntCu50hlj Df4RDd+pb3hjD6OE5Ol7uRoz7gxr8sU9754ZNC4pXoCWOB5icUdrf2haoFGtD63s SQKvvmVdVmLZqnuNih4qW9z4vXUcOlEtAXj/pO0joMfYSwTSZ74Fua3uLo26hnqT BafEyTIhBjuaxq37o9sKBoq5BFXv4E0PyyaSWNINJ/U2ms7Jck3Di1Z9yXn0GBRt JhJEIHF2haMjcMZidqZ6e9Ug/nR1mIizWHNP88YmeXGKyM/HcpKlv7HARhDw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=fm1; t= 1749410140; x=1749496540; bh=N4xWZtWA9zO8XOXoy2lJKNlwTczjTpnqEXg ALk1cLyc=; b=A5BJ4U2L9yIlQHxqy25Yz/TliEJ/7iX547tHEr+rxqTS1WqO1yL VWhgn7aeMPzeTE1Ju2fp0j3Hc4s0nHQntbJZTfLLXzYufrnaXqFqLF3j/R3Wb155 GgIGWz7IDITSycg49IDqK5zaTmuxUzCN12P9q1Qt25n8/Xh1iDGZaTJWV/H/qKhS YKmGzITbgkU4JPg8ChZwyaPaf2rhWRtfpqThbd60kUfhIRjfd54Rv6e4u3xjknd3 RCXgs05t1KDPqq5lkEYxr/c/MfBjBUamjfpB1ildaqHrpyiiZB8uZQWYS9D+AO7Z P3CnmnxJmodV2P3AKZYyuysOLUB/+fAAPmQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugdekvdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepofggfffhvffkjghfufgtsegrtderreertdejnecu hfhrohhmpedftfhosgcunfgrnhguvghrshdfuceorhhosgessghothhtlhgvugdrtghoug gvsheqnecuggftrfgrthhtvghrnhephfeukeeggeeugeeugeehieegueeluddtieduleeu keelhffftefhueelffetveehnecuffhomhgrihhnpehphhhprdhnvghtpdgvgihtvghrnh grlhhsrdhiohdpghhithhhuhgsrdgtohhmpdhtihguvgifrgihshdrihhonecuvehluhhs thgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprhhosgessghothhtlh gvugdrtghouggvshdpnhgspghrtghpthhtohepfedpmhhouggvpehsmhhtphhouhhtpdhr tghpthhtohepthhimhessggrshhtvghlshhtuhdrsggvpdhrtghpthhtohepihhnthgvrh hnrghlsheslhhishhtshdrphhhphdrnhgvthdprhgtphhtthhopehvohhlkhgvrhesthhi uggvfigrhihsqdhgmhgshhdrtghomh X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id E5CC31820067; Sun, 8 Jun 2025 15:15:39 -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: T79cb8f78b00f3e3f Date: Sun, 08 Jun 2025 21:15:19 +0200 To: "Volker Dusch" , "php internals" , =?UTF-8?Q?Tim_D=C3=BCsterhus?= Message-ID: <8f4bdf65-6237-45c8-92a9-82347dfb85a7@app.fastmail.com> In-Reply-To: References: Subject: Re: [PHP-DEV] [VOTE] Clone with v2 Content-Type: multipart/alternative; boundary=54771a20e2e140cb9977ddeb044705c4 From: rob@bottled.codes ("Rob Landers") --54771a20e2e140cb9977ddeb044705c4 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Wed, Jun 4, 2025, at 17:13, Volker Dusch wrote: > Hi everyone, >=20 > We just opened the vote for the "Clone with v2" RFC: >=20 > RFC: https://wiki.php.net/rfc/clone_with_v2 > Discussion: https://externals.io/message/127353 > PR: https://github.com/php/php-src/pull/18747 >=20 > As with every RFC, a 2/3 majority is required. > Voting ends 2025-06-18 at 15:30:00 UTC. >=20 > Kind regards, > Volker >=20 > -- > Volker Dusch > Head of Engineering > Tideways GmbH > K=C3=B6nigswinterer Str. 116 > 53227 Bonn > https://tideways.io/imprint >=20 > Sitz der Gesellschaft: Bonn > Gesch=C3=A4ftsf=C3=BChrer: Benjamin Au=C3=9Fenhofer (geb. Eberlei) > Registergericht: Amtsgericht Bonn, HRB 22127 I=E2=80=99m just now getting around to really digging into the RFC, and = I=E2=80=99m trying to understand what problems it is solving. "withers" as they=E2=80=99re often called in other languages that use "w= ith()" and this seems to implement, are most useful in cases of value/im= mutable objects. In PHP, this usually looks something like this: readonly class Money { private function __clone() { throw new LogicException("do not clone"); } public function __construct(public int $pennies) {} public function with(int $pennies) { return new self($pennies); } } $dollar =3D new Money(100); $quarter =3D $dollar->with(pennies: 25); This is an overly simple example; where we want to make sure we have a s= ingle "dollar" that would be equal to another "dollar". This implementat= ion of clone() seems like it would be quite useful here, but it appears = that setting __clone() to private would completely make this new clone()= break. So, it seems like this can only be used for things that can already be c= loned? Things which are directly trying to block an identical clone, but= would otherwise be fine with a clone that changes the value (e.g. value= objects) aren=E2=80=99t allowed to use this new feature? To me, that feels like an oversight in the design. =E2=80=94 Rob --54771a20e2e140cb9977ddeb044705c4 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
On Wed, Jun = 4, 2025, at 17:13, Volker Dusch wrote:
Hi everyone,
We just opened the vote for the "Clone with v2" RFC:


As with every RFC, a 2/3 majority is required= .
Voting ends 2025-06-18 at 15:30:00 UTC.

Kind regards,
Volker

--
Volker = Dusch
Head of Engineering
Tidew= ays GmbH
K=C3=B6nigswinterer Str. 116
53227 Bonn
Sitz der Gesellschaft: Bonn
Gesch=C3=A4ftsf=C3=BCh= rer: Benjamin Au=C3=9Fenhofer (geb. Eberlei)
Registergericht: = Amtsgericht Bonn, HRB 22127

I=E2=80=99m just now getting around to really digging = into the RFC, and I=E2=80=99m trying to understand what problems it is s= olving.

"withers" as they=E2=80=99re often call= ed in other languages that use "with()" and this seems to implement, are= most useful in cases of value/immutable objects. In PHP, this usually l= ooks something like this:

readonly class Money = {
  private function __clone() {
    = throw new LogicException("do not clone");
  }
&= nbsp; public function __construct(public int $pennies) {}
&nbs= p; public function with(int $pennies) { return new self($pennies); }
}

$dollar =3D new Money(100);
= $quarter =3D $dollar->with(pennies: 25);

Thi= s is an overly simple example; where we want to make sure we have a sing= le "dollar" that would be equal to another "dollar". This implementation= of clone() seems like it would be quite useful here, but it appears tha= t setting __clone() to private would completely make this new clone() br= eak.

So, it seems like this can only be used fo= r things that can already be cloned? Things which are directly trying to= block an identical clone, but would otherwise be fine with a clone that= changes the value (e.g. value objects) aren=E2=80=99t allowed to use th= is new feature?

To me, that feels like an overs= ight in the design.

=E2=80=94= Rob
--54771a20e2e140cb9977ddeb044705c4--