Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127651 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 9D7C81A00BC for ; Wed, 11 Jun 2025 19:37:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1749670550; bh=GER0bs+R3NTLyrW5D3GGGtpiUn+Rses8EF7qGb9zInk=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=NZ0bMRIw8szq80mjn6VohidPveNvtv80O6yM9RKoACCreANvV3SMarQwPKt2c/EKs SO1Eoky2L0OWFqxehR9cnS5iCXmwVNUlu/F2wyDLbn3VEyFSYtdbxHErTwYI4nMwjd IYaf1InUNFBvZEOuem/Ybdr1aao739rqlVkr/myJ2av5LzEsjDNmtWrQlbeeEMC/7a 3O5lIVwFor1bLuE+8JC+Go5J7Yt93jdmKyZZLJOVjDDbPT5ppA2ok4Kkqf2CxWIElp 87GhAscBfX/5tUzEAB4oCGvqnmz2fCeFoCI1a6fpDjD/1Ldk8nUGgg1vjYUm7P/AlD CnaqppYKOiWVA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 62E3B18004D for ; Wed, 11 Jun 2025 19:35:49 +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-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) (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 19:35:49 +0000 (UTC) Received: by mail-yb1-f171.google.com with SMTP id 3f1490d57ef6-e733a6ff491so173552276.2 for ; Wed, 11 Jun 2025 12:37:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dqxtech.net; s=google; t=1749670669; x=1750275469; 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=HtiYt0NRim1fmUcRHE8GTLuYd1qWX7J0P+YeLNgyaRA=; b=k0yR256a2BDXwHuFgD81AYccz6C+XFdSH0XZaXaUjfq9A6/TW5Kmfgk/76K1kaFH5v GmVwBSNH7mM4aDYH5R5XQygdFEO6cPK4k5WRWCePNeW+B8ka04wRcp+6NWYW0IBRf0ul +c3Pn0X9kpYMhRT4wyrIeW0HOqJORMk2SjuUZxubBlTpOdNOiORr3D+m8PvJPTfIohYE ITiRoppIikNB3C2mCC+hI+SSi0TLwYvc8DxpSLLDlW6Z65+mjBhjiC+6DaJ4eCYEis4W u8dpQAwOan5dFq2i7i7CDeT99ipS87NZejOsjzQksb2nQCyQxgsPdTBggw1gnUinS8kv Id5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749670669; x=1750275469; 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=HtiYt0NRim1fmUcRHE8GTLuYd1qWX7J0P+YeLNgyaRA=; b=gSe2b8VkVmukrKBk1gnOESUq1njS4IrC1uI7Kq5sdWqL6JcHULnencG3VmwaTMAqBQ HIvdXSp5iZbbDexDmfOXt5WCfhQ0o7cb2wPJDWZLsWkOKgFJHe0Zmsd7iXrrE5JrI+Ve 4+/D19tUT8fW023qn8p5weTWtwraZKCrLtSeE64DdYgtjsIRdz6smZN+Xt5B+ejSgeut YSzZ3+STNfXYA1Znz5SK4KPpYtXCqnv+LYdRCNw3XYJqA8C07CD8ULPY/V+iQ+oGD1DJ X0aQm+5RXjdDah9sFJhFT2ED4WaSwIXypusb+j/flUna7jZUmhJ6YmiQ6kHtxJyHX85Y XGtQ== X-Forwarded-Encrypted: i=1; AJvYcCXqwXEap/mmjRxBThNN3mdo84GTwNdnKgXgADHO44WqsEK8y/3//0UPde8FmCFauDBKQfiuCJsQUJE=@lists.php.net X-Gm-Message-State: AOJu0YwKSON3eYjc5oSJGBDYMq+MYaVeBir+9E71ZuGaT7DoGWgDmdGC UtYis47hOFQczsO1CeQ6xrpU6DWZvUOekaIcvK/c1qQlFBwcxsgLFykV5vEn+upKE7kl5vBQV1U jHFwUbhJ4bGZfkwu04LW8DnYBAKTJwRdJMovcrzdNzQ== X-Gm-Gg: ASbGnctVy6ozlEUzY+bG6kb2ETySFHapISzxnfoNNliOFFS+0bhEYa6pNxJFFaX7moC V/fEJZA2OcAam1tJ1iFPrSSV7pEvkA64CLmIgAVWVo3VVJLEU6iV+L48c+EGHMzGJEFhF3SXuv7 Q8nHW0z+s4W4rj3uVJamP4Pa6IOOYfdRNCAP34OnaAcY7vZRZtQiTGRV7WqdqiePJtbmqmbZ4jS f09FQ== X-Google-Smtp-Source: AGHT+IFwz1x4KASab/V+1qprlSqWjcQlgM9oXSaHw7HAyVsR0RHgnKk8mFUp22IsdDs7v4rI0gr9dBeVFaPIsyW/bVA= X-Received: by 2002:a05:6902:1208:b0:e7f:7334:3fa2 with SMTP id 3f1490d57ef6-e820b64c926mr1318328276.2.1749670669275; Wed, 11 Jun 2025 12:37:49 -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 21:37:38 +0200 X-Gm-Features: AX0GCFt6OsIaPQQrm9n4_KT2P6wXSt1GiAvyrPaUAMvjBGK61CWOjHO_V-Hdeow 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 Thu, 5 Jun 2025 at 16:43, Volker Dusch wrote: > > 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 re= asons. >> >> 1. The switch to an array parameter, as previously noted, is a major DX = loss for unclear benefit. It's just all-around a worse design, and "maybe = 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 multipl= e long explanations, when this was thankfully unearthed during RFC discussi= on. > Inventing a new syntax for this specific function call is something, I co= uldn't go forward with this, and I think we explained well why in the threa= d. > > But to sum up again for the benefits of readers: Using a ...variadic to g= enerate a key-value array is something php-src doesn't do anywhere currentl= y, and it has multiple issues and edge cases. It is making the language mor= e inconsistent and harder to use. Adding this special syntax for a single f= unction is unacceptable to me. While it looks nicer to people who don't us= e or like PHP arrays much, an array is PHP's, especially php-src's, main wa= y of passing a list of key-value pairs. > While vibes-based language design is tempting, and I've fallen for it ini= tially in this RFC. I want to work with the reality of how PHP works here a= nd not leave all problems coming from this to the core team. The alternativ= e syntax would introduce extra documentation effort, inconsistency in how P= HP core functions work, and generate bug reports stemming from the edge cas= es outlined. I'd rather not have the feature at all than burden maintainers= with this. Especially given how negligible the difference is in typing eff= ort is in the end, and how it doesn't change static analysis or IDE support= . 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 have= been attached to this in the first place. Extracting the ideas from this d= iscussion into things like `#[NamedParameterOnly]`, a potential 3rd array s= yntax `[foo: "bar"]` people argued for, or ideas like this https://github.c= om/php/php-src/pull/18613 . But none of this has a place in clone-with as i= ntroducing a new way of defining an array here instead of somewhere generic= isn't something I feel helps PHP. > >> >> 2. There was still an active discussion with Nicolas going on that seeme= d rather important. Opening the vote while that was still going on is, as = noted above, problematic. >> >> --Larry Garfield > > > We answered the concerns multiple times in the discussion, including decl= aring it out of scope in the initial RFC text and explaining the issues wit= h adding parameters to __clone in the discussions. > This RFC also leaves these, very much out of scope for this RFC, open in = the future. They would massively increase the scope of this and require a t= on of discussion that killed the first attempt at incremental improvement a= lready. There is a big thing here that will narrow the possibilities for a follow-u= p. "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. > > So from my perspective, there was no active discussion going on as nobody= else spoke up for a week and nothing changed with Nicolas, admittedly regr= ettably timed, last email. Which we also answered in detail. So I fail to s= ee 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 others,= is not a desired outcome for me and as this implementation doesn't block a= ny 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