Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127398 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 E7C1A1A00BC for ; Mon, 19 May 2025 10:57:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1747652125; bh=ydZ+grN8PzUD5fTM5X62tw8p8OeaJwmx2YmfRiOr+PA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=iAyDlYB39/2ZqkzIcKgc49ke7Kyf27FoNCSOFP+8kj1vg3fEt4DwJ7CSiLx4g8gpD dUu3+jju4cl61FrHL3SsYB62Vr8aDVA93WQncrjmsVqS380qmaeZYjzfmbBgf7+Tuj m6Z/eqmBPvUa2GUfEGbNw7ZKG6SE3ylTnMzMTxh8s2Jsf18PMY34HJhBbbdIBKPGCp YuZ8fncpdilB44UgMwsRwbwkBA4gICDxhht3VmfaWb4YiDvuLHw+fuH2LK6p9Uk/gd QpxxF4y/B4AkPY0sw4rKmvt1NZgv2pG8SAvxA3o4COplzuPUHPQG97V0Ngbp0QS/rA c0/VY0MQ5k3hw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A35B31801C7 for ; Mon, 19 May 2025 10:55:24 +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=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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 mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) (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 ; Mon, 19 May 2025 10:55:24 +0000 (UTC) Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-601ad859ec0so3053950a12.0 for ; Mon, 19 May 2025 03:57:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tideways-gmbh.com; s=google; t=1747652252; x=1748257052; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ydZ+grN8PzUD5fTM5X62tw8p8OeaJwmx2YmfRiOr+PA=; b=McbZGXL0kCkFxToVYVeFmDkX/U50o1nzyvtLQjDNsRPLibZcvLRNGM9LP5F40Yn3/o ntBQk6YjlyIs4I7g4MHRhGpm/7idNlnJ/SudqIUAgWpRp00z8Z3dgUE/hfbJURp4h/ij gLEgl8dGsMQB0kX2aicS20HIo0+3DMxJuP4eT1C611gYO6wO2FkLMeUZ+QatEeNtM+Si TeGgRhxobIFhOehPkmUycHXKBUKPd5lRkz9HaFCfXMfYvp3szb231fSafAtXy5GyUdr8 dBzgnNlI72hVP4XTBjaTEmKCTKFvF2MZCAZ/Bi2MT5/ahieZy4zJEHZi+9lx3/qSbjlE king== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747652252; x=1748257052; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ydZ+grN8PzUD5fTM5X62tw8p8OeaJwmx2YmfRiOr+PA=; b=hPA1YxZCkAMhJ70ImxAnkbbWg74hrKyzFyevfo/8upIokwqdHiTCdxQFPL35T1IvxI 0uHa3eOiMZVJ+eeq+HXMohIDJCnJpbuoJzfAFMiHefkxDKNiRBAmoMNLYWswaEa3w8e/ 3eAeDJ8mNyKGqOsEFdfBv+bzSQ20PQzRELjTmRBfMZlpVKXCTu/UOWl4DxhSU8CwUxgb qA0ESCjzOkNJ9v5BlpVpz3qrU3O8Qnexn5vqYPhtLK5Z4b6AOZhQZngKiFcnN3Pxnimt fmPOr1LMuWONkX/t8rQfdNSGPGjJ4yMlnreDwekS9L3HnUHaVTL5V6RNXpHEQgiu70Xx 9e4w== X-Gm-Message-State: AOJu0YzKqoafgF6W0l7sPnvFFDG0TyNUbONeqb2IFY+7HCPfhQrOT6aV 9koqzqtUMhYCoIRmF+fKAHQaZwQt9haBcUseK7cTpuyg1JgmwfNoIgRUh3/uCudFh7v8QY4NOtM 0b3ut0aANzIXmLTToQGT1NjIEo++Esl9ROrp7xDgNXcsemf5MBG2ukVE= X-Gm-Gg: ASbGncvjutAG9JPalEZM1K9r/+lleYKN7asIoZ4ojU0+HfLQBj6tA/SV43W+gYNamI0 DBiX/aEFGIGCyJY1a8bHlhZ1Hfc5uQtnKTeEh5BZbzDiM/UU1k1tGvSmEq4ie6gH4oYFeN0qJR4 MQFlPF+9djWBNJS9nRdLvYqMJ9zSuRrG5JmHgw5FkKU4nxHze7dMAnzzL2+rFqKXc= X-Google-Smtp-Source: AGHT+IEIP9uP766gBSTbOAONvTqcKcy18jriRdKgavPFEmDw7LrNO0aD4TpxVpZn4RUv1pYXHvieIg3as6KNdtUjLew= X-Received: by 2002:a17:907:6d23:b0:ad1:fa48:da0a with SMTP id a640c23a62f3a-ad52d5578efmr1092467566b.35.1747652252294; Mon, 19 May 2025 03:57:32 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <266FA35A-15B0-435E-BBFE-1C6926EB0B7E@koalephant.com> <7ec1997d-a8d4-43fd-870f-9a18872c7c8f@rwec.co.uk> In-Reply-To: <7ec1997d-a8d4-43fd-870f-9a18872c7c8f@rwec.co.uk> Date: Mon, 19 May 2025 12:57:20 +0200 X-Gm-Features: AX0GCFuv5j3KJ8VRLmYYW25DXFHTu26hsDEI-afEfk7nR_jKLmu4vlORxW_yt_s Message-ID: Subject: Re: [PHP-DEV] [RFC] Clone with v2 To: "Rowan Tommins [IMSoP]" Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000b0812d06357affde" From: volker@tideways-gmbh.com (Volker Dusch) --000000000000b0812d06357affde Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, May 16, 2025 at 8:46=E2=80=AFPM Rowan Tommins [IMSoP] wrote: > However, readonly properties are "protected(set)" by default, so the > situations where this can happen are actually quite limited: > > - Code inside the class itself (private scope) can reasonably be > considered to be "opting in" to the feature it's using. > - Code in a sub-class (protected scope) can by default over-ride the > constructor anyway. > - Code outside the class (public scope) will fail unless the property is > explicitly "readonly public(set)", which would be pointless if it was > always initialised in the constructor. > > > So the only case I can think of where something surprising could happen i= s: > > 1. A public or protected readonly property is initialised in a > constructor marked "final" > 2. A sub-class adds code that uses "clone with" to set that property to > a new value > > The question then is, how worried are we about that scenario? > Your summary matches my ideas around the topic and I've updated the RFC [1] to better clarify that we consider touching __clone to be out of scope. From our perspective, we are not worried about the Points (1&2) you raised and are not interested in solving this by providing parameters to __clone as the additional cost, issues, and complexity are not a worthwhile tradeoff in our eyes. Kind Regards, Volker [1] https://news-web.php.net/php.internals/127397 --=20 Volker Dusch Head of Engineering Tideways GmbH K=C3=B6nigswinterer Str. 116 53227 Bonn https://tideways.io/imprint Sitz der Gesellschaft: Bonn Gesch=C3=A4ftsf=C3=BChrer: Benjamin Au=C3=9Fenhofer (geb. Eberlei) Registergericht: Amtsgericht Bonn, HRB 22127 --000000000000b0812d06357affde Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Fri, May 16, 2025 at 8:46=E2=80=AFPM R= owan Tommins [IMSoP] <imsop.php@= rwec.co.uk> wrote:
=C2=A0
However, readonly properties are "protected(set)" by default, so = the
situations where this can happen are actually quite limited:

- Code inside the class itself (private scope) can reasonably be
considered to be "opting in" to the feature it's using.
- Code in a sub-class (protected scope) can by default over-ride the
constructor anyway.
- Code outside the class (public scope) will fail unless the property is explicitly "readonly public(set)", which would be pointless if it= was
always initialised in the constructor.


So the only case I can think of where something surprising could happen is:=

1. A public or protected readonly property is initialised in a
constructor marked "final"
2. A sub-class adds code that uses "clone with" to set that prope= rty to
a new value

The question then is, how worried are we about that scenario?

Your summary matches my ideas around the topic and I= 've updated the RFC [1] to better clarify that we consider touching __c= lone to be out of scope.

From our perspective, we = are not worried about the=C2=A0Points (1&2) you raised and are not inte= rested in solving this by providing parameters to __clone as the additional= cost, issues, and complexity are not a worthwhile tradeoff in our eyes.

Kind Regards,
Volker

<= div>[1]=C2=A0http= s://news-web.php.net/php.internals/127397


=
=C2=A0
=C2=A0
--
Volker Dusch
Head of Engineering
Tideways GmbH
K=C3=B6nigswinterer Str. 116
53227 Bonn<= /div>

<= /div>
Sitz der Gesellschaft: Bonn
Gesch=C3=A4ftsf=C3=BChrer: = Benjamin Au=C3=9Fenhofer (geb. Eberlei)
Registergericht: Amtsgeri= cht Bonn, HRB 22127
--000000000000b0812d06357affde--