Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127365 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 48FA81A00BC for ; Wed, 14 May 2025 22:09:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1747260418; bh=GaPTjbVhIgSvjglhbnuz623iVC24oGAdvMgrVnl8OCk=; h=Date:From:To:In-Reply-To:References:Subject:From; b=UnQUTKJHE6DeCyZK0CN4ZhRYEgLixr7g1F7F+16Dgf24YZhnvj7iksZ2nNdPse0iK IrjYtFWZAdtE/K7bjbux4eykFbCF4dvavvqqkyI4anu9LR0721TrJD9IJbMQit1Pl7 oaf9EcubJbQ+XgiQ7gOaFsdLU8H75XO3LKbagf+Vq11XPRUjO/e6HOlt6ArlQBysPc ClXH1jSQx58X2NkF8eefk7Fp5c/fNEPIWsFHm2kimz1/sN5RqmIci4P+7CQyXW18kZ h+TNNEJ/f7HdsozogUNxL105+vOcYHa77G8GEFhE1lt2kEcJ+E2Ed3vHL5gWE+Kv0Z Jpvb1sc6AiU6w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7BBAA1801E4 for ; Wed, 14 May 2025 22:06:57 +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=-1.4 required=5.0 tests=BAYES_05,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 fout-b3-smtp.messagingengine.com (fout-b3-smtp.messagingengine.com [202.12.124.146]) (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 22:06:57 +0000 (UTC) Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfout.stl.internal (Postfix) with ESMTP id EE6581140104 for ; Wed, 14 May 2025 18:09:07 -0400 (EDT) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-10.internal (MEProxy); Wed, 14 May 2025 18:09:08 -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=1747260547; x=1747346947; bh=vtVyC+1GdCg55bSH9wO4Z owCc5eGqh5x0u7JuBwudDM=; b=Hd7VBoQcSuzm+0Ew6O1MlhR8H8fzPYTgUT+Yy 14A+npay7srX5wMe7X791qT2AObQ/gY8CadKpw5/RGI0JALLWQtWigDG82gTSQhT AaY4fA6smwuK/0TnCo57XZDCTcmNYMQihT5NTE5u6w6FZcNHNmoT0hw50EDZ+APC lARGxm0CVqYIvmJSttat+n4tz1V00pcC019wd4fDIJ3MNKWq5u6I4XWmXUUaaDm1 tmkEePogY2raauKYgnMpXLJUVLCuPFPhYlN65ZOWziE0e6DjbOXTk1MPKYPVGFNB 88DWADD7CZ1tDU9PJLY6fDx+Q75VUxQvzbogAbB3/9bBgczIA== 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=1747260547; x=1747346947; bh=v tVyC+1GdCg55bSH9wO4ZowCc5eGqh5x0u7JuBwudDM=; b=s3yMYIdb2EjD0fgW2 IPXXUjfp4RqMxtR5S4yBkOJ2C4WPUjsd6UOtqGT3I61sZGOFoRhuAStM4lMWXR3X MCzwbj8Oc//ddWoXEmBKkcINXYE8Kn8cKYeVjE6lmaaNlzKm170X+cntePHt88sY K2G8wDzzcntDFKMBYoztxNdf4H8AMjL/fRaod1OqbY5qGKOl1+v56jc1s9x0rQDw j4oVpuTEKus37vj6LxABry5AcMb6Xg0gdMImJdZxYI2vYVuvPckjJgqFxUrPT5Jx G3vhPBAm4WMmMus4+CwrxMIUNBH7V7WtesSAk98G/f9ZjjnEh/htmaqzJhzM++/m NOYLw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdeftdekudehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhepofggfffhvffkjghfufgtgfesthhqredtredt jeenucfhrhhomhepfdfnrghrrhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrh hfihgvlhguthgvtghhrdgtohhmqeenucggtffrrghtthgvrhhnpeffieeivdfhvdeguddt tdegteeiueegvefhteehfeeffeetudeitdehtdegjeeuieenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghlught vggthhdrtghomhdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtg hpthhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 8975E70005D; Wed, 14 May 2025 18:09:07 -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 17:08:47 -0500 To: "php internals" Message-ID: In-Reply-To: References: <533ea02a-dd69-4de9-8526-f808c5a9f4a1@app.fastmail.com> Subject: Re: [PHP-DEV] [RFC] Clone with v2 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Wed, May 14, 2025, at 2:54 PM, Volker Dusch wrote: > On Wed, May 14, 2025 at 5:40=E2=80=AFPM Larry Garfield wrote: >>> A magic __clone() method will be called before the new properties ar= e assigned. >> Why before and not after? I could probably make a good argument eith= er direction, but we should be explicit about why we're making whatever = decision. > > From a user-facing perspective, calling __clone() before makes it easy=20 > to know which state the object is in; all parameters are how they've=20 > been before the clone operation started and are therefore consistent.=20 > When calling __clone() afterward access to the new properties would=20 > already be set and the old ones gone, making this potentially harder t= o=20 > work with and harder to adapt existing implementations. So we chose th= e=20 > one that causes fewer potential issues and gotchas. =20 Please include this in the RFC. > Let me just reiterate here that I find the difference to be minor to=20 > negligible. IDE/Tooling support needs to be built explicitly either wa= y=20 > and is not harder or easier to do, and the ergonomics are quite=20 > unaffected in my opinion. So the worst outcome, for me, would be that=20 > we get hung up on the syntax here. I think the current syntax is optimal. >> One shouldn't be using a named argument for that anyway. > > I'm not sure what you mean by that. Just so we're clear:=20 > `...["__object" =3D> "foo"]` would also not work with the current=20 > implementation, as that's the same thing as a `__object: $value` named=20 > argument. (Should we decide to name the first parameter __object here)= .=20 > Sorry if I'm misunderstanding. The concern is someone calling clone($foo, object: new Thingie()), which= would complain that "object" is defined twice. Making the first argume= nt named __object sidesteps that issue. If someone then calls clone(prop: 'new val', __object: $foo), that... I = suppose would technically compile, but one should never do that, and I a= m perfectly happy if that breaks. Similar for if someone called clone(p= rop: 'new val', object: $foo) if we didn't rename that parameter. No on= e should be doing that and I am fine if that breaks. --Larry Garfield