Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127652 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 49FC31A00BC for ; Wed, 11 Jun 2025 20:09:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1749672465; bh=xjbG1Jipt3QIW/P5sN78EL/y0ilJmwR67Zz1EAKpYyw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=OWK2VrmH20I406IO2RF/AWndF/QaRdPUfUeuvPhp7lTcfxY0zhvXVwcOAgcrZIdFk ZyzCKKX8fM3/qYcGW5LE3NSBK9LtKJy3PBjwTm5JxDTT9uONnDQnezdcMbWisBvbZu FLp9oaP8tTl0VKmYzHQv1jNJZq/9woliy85sbJmG/KB4BkP9rd6XxYscPEJvk0zarC 1P6Qzdp1uunLSVJDetL1QqHmRzaWuBXWzP3D538qOC06Lc0GkCp9M78oqcXRXMbFWU /HJILsrqCYtp4sWVpMhJOv49ovWKjBg0uw3d7IuNFQxDMAJSYzFzNzk3PgFQwF7DPw JVXp89ujcJL0w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 494D5180034 for ; Wed, 11 Jun 2025 20:07:44 +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=-1.2 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,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 mail-yb1-f174.google.com (mail-yb1-f174.google.com [209.85.219.174]) (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, 11 Jun 2025 20:07:44 +0000 (UTC) Received: by mail-yb1-f174.google.com with SMTP id 3f1490d57ef6-e7b4ba530feso184730276.1 for ; Wed, 11 Jun 2025 13:09:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dqxtech.net; s=google; t=1749672584; x=1750277384; darn=lists.php.net; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=WloZHiHQ5piC771X/tMjfLzC4GfyDZA2Eeu/WySZueo=; b=QjTXkj2AsBNBKZnnAGGdZY373xbHszRK7PU/ib3zNtNgEDZvEedFSQXF1h1eYuJ5KV YsolXy5OlG8avKQh4+j0/mgK9C9B5mxvzbzUObvIxF39tdN69volE/CWRHuF2RY3vVH/ wbnRtB02MfIQGBUl1zwhUHeywy+vtMT3JwjPR6mqdKgtfxeEy8AS5mA6uuZDA4RsK3gU I7lXhNRpQX1/XcuAeHtz1/FVsAFYdCBQM65ua3J2l3Q8SucRYXvRhDNewi3vf/4IHjpc nl5CiR+RkSMxLxsRl1Q2MelL9vn2zDLkCf6z/T4NILWw8Uwnh8GU/cCIZPkF9K8qmcoQ 0sKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749672584; x=1750277384; h=content-transfer-encoding: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=WloZHiHQ5piC771X/tMjfLzC4GfyDZA2Eeu/WySZueo=; b=sOBXcE81OWlI4Rcziop5vvX4K/LppzJawi8N6sxTGIwdbsrG6OWM8gqiXYmrVjuWfh wNLOvZ297pY//kkJDi02titVScn0CfJJKr7PmrMxRFbeLs2UfWrn2LHYZE2kk1XpdAg0 m94wfTdn7r7pihhcQi1dUYqcXvsooDcGUN6RoOJuLU+x4nz7LvD7jUI4XG6DxOEheHdt BwNXG9ztM3wQIW1BZTbLr8T+qrgGR3mThtmbaQrU6ay+7iEvm+5VC0i0JsR93MhuUuBL se32Po6Q99kbv/Cmj9wn1E1B+xWv+AWeHIgrtjHsqIYUR3ybX6N4JIM+kFoaOPH3FJNi kuRQ== X-Forwarded-Encrypted: i=1; AJvYcCWDCTkawoPFP4s1ce4G04u2k7dj3jO47cy5nMDFPRK+ba1Ev7LmrnTAApduV1G+ibexxrzjM+5NUus=@lists.php.net X-Gm-Message-State: AOJu0YzV1lvy+Gj80XJsdiU2scSdua0S8yAqeQBFrdDyuVlDO47k3TMu DAjmj9C3qRSr+vdZ1H/UeacAomYk5S+NRnUSVIDomJztIfrqebJ7nh7tdJ+lZWyAnE1MmyVPLz/ /VPDCdU/bkPzSDbj1/f/VJMjv4421IpYOCEJfkqWnfg== X-Gm-Gg: ASbGnctAEOE5eX/Lyy2TdPATTP61TFPf2vNEwW68PXSK5f0X18C9pehYW7NOtYOXmsn YX0LGnmNPtHZWpBV6FOm483P6T2gXcfzPyqWPMfUyz8VbKdZnT0daKPAxtamAEHioac2LKZP0W/ gkfrPddcYv54CtqWgCPk6DmGJHdfTVH4ZbtqEZR6V0vkH9Np627DiQu9SE3UDtCXqA37lXVdfVU 49R9A== X-Google-Smtp-Source: AGHT+IG1ZLucpxe99braAxhSeZ0yu8dy54NG1rD+OcIDJ3t8fLV+d/qS34KrLSyeuWoSFfVx8EpZB8qSOADODsS83fo= X-Received: by 2002:a05:6902:1102:b0:e81:a91b:d920 with SMTP id 3f1490d57ef6-e820b74bae2mr1235172276.46.1749672584151; Wed, 11 Jun 2025 13:09:44 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 11 Jun 2025 22:09:31 +0200 X-Gm-Features: AX0GCFveHyNxq9BQ7TvIGzaBjPUfjlIye671vjzvhO9y2MeOGmiX2Zw92cxDtHs Message-ID: Subject: Re: [PHP-DEV] [VOTE] Clone with v2 To: Volker Dusch Cc: Larry Garfield , php internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: andreas@dqxtech.net (Andreas Hennings) On Wed, 11 Jun 2025 at 21:37, Andreas Hennings wrote: > > On Thu, 5 Jun 2025 at 16:43, Volker Dusch wrot= e: > > > > On Wed, Jun 4, 2025 at 6:41=E2=80=AFPM Larry Garfield wrote: > >> > >> While I support this RFC and want to see it in, I have voted no for 2 = reasons. > >> > >> 1. The switch to an array parameter, as previously noted, is a major D= X loss for unclear benefit. It's just all-around a worse design, and "mayb= e we can change how arrays work in the future" is not an answer. > > > > > > It is frustrating that you claim the benefits to be unclear after multi= ple long explanations, when this was thankfully unearthed during RFC discus= sion. > > Inventing a new syntax for this specific function call is something, I = couldn't go forward with this, and I think we explained well why in the thr= ead. > > > > But to sum up again for the benefits of readers: Using a ...variadic to= generate a key-value array is something php-src doesn't do anywhere curren= tly, and it has multiple issues and edge cases. It is making the language m= ore inconsistent and harder to use. Adding this special syntax for a single= function is unacceptable to me. While it looks nicer to people who don't = use or like PHP arrays much, an array is PHP's, especially php-src's, main = way of passing a list of key-value pairs. > > While vibes-based language design is tempting, and I've fallen for it i= nitially in this RFC. I want to work with the reality of how PHP works here= and not leave all problems coming from this to the core team. The alternat= ive syntax would introduce extra documentation effort, inconsistency in how= PHP core functions work, and generate bug reports stemming from the edge c= ases outlined. I'd rather not have the feature at all than burden maintaine= rs with this. Especially given how negligible the difference is in typing e= ffort is in the end, and how it doesn't change static analysis or IDE suppo= rt. But I know we disagree on that point. > > While these are valid arguments, I don't know that the other thread > had enough time to settle and agree on this array syntax. > The last time I looked at it, it still had the named arguments. > (Unfortunately I don't have permissions to see the RFC edit history, > so not sure how long ago this was changed.) > > > > > This RFC is also leaving room for future improvement by still allowing = to add further parameters if the unforeseen need for this should come up. > > > > Ideas around changing PHPs syntax for key-value pair lists shouldn't ha= ve been attached to this in the first place. Extracting the ideas from this= discussion into things like `#[NamedParameterOnly]`, a potential 3rd array= syntax `[foo: "bar"]` people argued for, or ideas like this https://github= .com/php/php-src/pull/18613 . But none of this has a place in clone-with as= introducing a new way of defining an array here instead of somewhere gener= ic isn't something I feel helps PHP. > > > >> > >> 2. There was still an active discussion with Nicolas going on that see= med rather important. Opening the vote while that was still going on is, a= s noted above, problematic. > >> > >> --Larry Garfield > > > > > > We answered the concerns multiple times in the discussion, including de= claring it out of scope in the initial RFC text and explaining the issues w= ith adding parameters to __clone in the discussions. > > This RFC also leaves these, very much out of scope for this RFC, open i= n the future. They would massively increase the scope of this and require a= ton of discussion that killed the first attempt at incremental improvement= already. > > There is a big thing here that will narrow the possibilities for a follow= -up. > > "A magic __clone() method will be called before the new properties are > assigned." > > The proposed change by Nicolas would require the __clone() method to > be invoked _after_ the new properties are assigned, (and pass the > original object as a parameter). > By accepting the RFC as it is, we close the door to Nicolas' proposal, > at least once this is released to the public. > > In the other thread I proposed an alternative where instead of passing > the original object as a parameter to __clone(), we are passing the > values from the "clone with" call. > This would be more suitable when __clone() is called before the values > are assigned. > However, both Nicolas and me found problems with this approach. I should add to this. Nicolas pointed out the symmetry of the arguments made around calling __clone before vs after. E.g. in the RFC we currently see this: > Calling __clone() afterward would mean the new properties would already b= e set and the old ones gone, contrasting existing behavior and thus users' = expectations. But in fact both of the following sentences are true: - Currently, no further changes are applied to a cloned object after __clone() is called. - Currently, no changes are applied to a cloned object before __clone() is called. Both of these statements can describe user expectations, but each of them justifies a different version of the RFC. > > > > > So from my perspective, there was no active discussion going on as nobo= dy else spoke up for a week and nothing changed with Nicolas, admittedly re= grettably timed, last email. Which we also answered in detail. So I fail to= see how this problematic. > > I don't see Nicolas' last email from 4 Jun being answered. > It is in fact the last email in that thread. > And one week is not very long. > > > > > Letting the RFC peter out and die in the discussion, like so many other= s, is not a desired outcome for me and as this implementation doesn't block= any future improvements or make anything worse in userland. > > As always, the RFC will block any alternative version of itself. > E.g. if we release the array version (as currently proposed), we > cannot later switch to a named arguments version. > If we release the "call __clone() before assigning values", we cannot > later switch to "call __clone() after assigning values". > So, this does indeed feel rushed. > > --- Andreas > > > > > Regards, > > Volker > > > > -- > > 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