Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120429 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 42466 invoked from network); 29 May 2023 14:59:49 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 29 May 2023 14:59:49 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A6F3F18004D for ; Mon, 29 May 2023 07:59:48 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-oo1-f42.google.com (mail-oo1-f42.google.com [209.85.161.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 29 May 2023 07:59:45 -0700 (PDT) Received: by mail-oo1-f42.google.com with SMTP id 006d021491bc7-557c9d7011aso2365516eaf.1 for ; Mon, 29 May 2023 07:59:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685372384; x=1687964384; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=le1l3iei1iOK0tDStTHgRvq/XHu1VFhboSjDoQowAKw=; b=UY0DP1r5f47cfP5FsRlqUqnHg0vLjBVLYurDGUIzNSAk6WaN8Kd3yXV+wGPkx2Sb3+ CxVx2fKJxV5t14cKAkcHf5crd2GStaPyzrX3VacG6arTvVKqk6V7q4pEx/A8Sfy5zLUk 6LNsQjXuOon5J1v+Av7r+wLn1VyBO+M9qh1tQfZGAaZa+kbyUokuEt4Q5L8wTzze/Et4 bnip01jwjRzGBPMYL87WbLiED4I/blxCP/UZeevW030wjFHTTk9Vn3rFWVZDPGuFSsJE Z9qJgNytipSTiktK3OdorUnaIBwUYgf0mChtMgw0ZBm21Zyw0v+uG+RrwQYOtXXoXDZy WZKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685372384; x=1687964384; h=content-transfer-encoding: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=le1l3iei1iOK0tDStTHgRvq/XHu1VFhboSjDoQowAKw=; b=EQONDNFHGdJwGaeek9XGlsf03mKaiiuN045UVu+lLy2RksZ+ujKrrJbQmxjxbF15MD YGUY5qFj9T7ExDT5KTQoDuLdLTcdvOW5+tDq/mK5TzMynPRwTf2iG4EhkBsT26/+NP1z bsZJDHAKzkCr8OKplqowGp7LkyHj6aMX8PnUDZoqFBx0O1qd7MWpr3m7XWCbbz+ib/6E EtsCapkbhSi5QZ2uAWM/RA1dLKqakWAezy1RS+aMEwigJ1QRKR6BTYaptYiEG2KvUa85 v1iyK1F7Nz5riJ6gUT3Ilbz81kJetTsKynh3+ciRCZS23OLnGiXTFt4ZlAcEU1pEF+yC gJ/g== X-Gm-Message-State: AC+VfDyMSI9TeKMJaQkiHbjB1puyuu7fiXcHcqPxaXiXWMz1CMi7a+ca Mm2tsd3oz6maYIpsyf/xAwZCpMbYF233jL9ny08/Cy4h X-Google-Smtp-Source: ACHHUZ6NsgIQGxwrCNFii8P4t/hrVFE7EK2lgC/080/SAYTBJs+SaiiDGijmWQ0GTOeYR9b66gnMxvsBtvfTFh8sbcg= X-Received: by 2002:a4a:d484:0:b0:54f:4e01:7fc9 with SMTP id o4-20020a4ad484000000b0054f4e017fc9mr3819275oos.3.1685372384227; Mon, 29 May 2023 07:59:44 -0700 (PDT) MIME-Version: 1.0 References: <799ae864-6e25-4196-a5ce-0d74600a8378@app.fastmail.com> In-Reply-To: Date: Mon, 29 May 2023 09:59:33 -0500 Message-ID: To: php internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] [Discussion] Clone with From: brandonja991@gmail.com (Brandon Jackson) Hello everyone, On Mon, May 29, 2023 at 6:48=E2=80=AFAM Micha=C5=82 Marcin Brzuchalski wrote: > So there would be no option to vote on shorthand properties, right? > > Array syntax with all properties as strings in quotes probably means no > support from IDE. > I think this is a really bad move, I'd be against it. I agree. I think going to a single syntax was a good move, but using the li= teral property name would have been better imo. I really think the syntax would benefit from being more similar to function calls, with a syntax like: clone $obj with (prop1: "value"); This brings the familiarity from named arguments, which in this case would represent the object's properties. Then for dynamic property name support, you can borrow array unpacking into an argument list from function calls as well, allowing the dynamic properties to be set like: $myProp =3D 'prop1'; clone $obj with (...[$myProp =3D> 'value']); This also gives the ability to have create dynamic properties via anonymous function as well, like so: $myFunc =3D function ($original): array { $props =3D []; // add results return $props; }; clone $obj with (...$myFunc($obj)); You even have the ability to pass it whatever you want including the origin= al object to operate off of. Regards, Brandon Jackson