Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120435 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 59581 invoked from network); 29 May 2023 18:38:19 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 29 May 2023 18:38:19 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 54FF818053F for ; Mon, 29 May 2023 11:38:18 -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,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15576 212.103.64.0/19 X-Spam-Virus: No X-Envelope-From: Received: from mx.kolabnow.com (mx.kolabnow.com [212.103.80.155]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 29 May 2023 11:38:17 -0700 (PDT) Received: from localhost (unknown [127.0.0.1]) by mx.kolabnow.com (Postfix) with ESMTP id B8DAC9D5 for ; Mon, 29 May 2023 20:38:15 +0200 (CEST) Authentication-Results: ext-mx-out001.mykolab.com (amavisd-new); dkim=pass (4096-bit key) reason="pass (just generated, assumed good)" header.d=kolabnow.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kolabnow.com; h= content-transfer-encoding:content-type:content-type:in-reply-to :from:from:content-language:references:subject:subject :mime-version:date:date:message-id:received:received:received; s=dkim20160331; t=1685385492; x=1687199893; bh=mdMvmdU4vry4Sw8h 7VyToz5ObBVbjr3J5dIlVmwd/D4=; b=pDl8n7YmE79Ct1ANc8+afDUJm92PcE4d dp6cPg3MZSIgT19oGyiot6OWibHrXBByNKMegpXMciMkjxyOGtuBgplGT4pG9qgF fetrBf+0h+sTsPqj7YIaDOsur1SIUBmOi4XoPO31IoAR1wNuc+bt+QRBXjKJqB3V t8lZwG7egNRcnNo1foBFAubCoEIxqOQRtqpl7GX7NiMbxHM8GsBuk50Z7ubJofKC 4IQZnIx/Y8cCuMfIThefGo93ySTI17Waif1jKCG9+yV3nVePforJ5UP5yLtuPC8q GFoccp4WcTFrV5fpYcVysx02WBo1x4LrBmTbuKEzG7HA243cstaMimtsJfvWLJgU kFLMFimkz/S84FaTr+K8ileI6Jel38gmtfoV+EBBx6WlWILClTW03PxHtjqbSAfI Tfo0YOeQ1exYVyxIkpB8KEzqVWC5MM4Mman2UtiyX2SK6naPoL1qtnF0nLHQdYPM DAm/bE4uJWxa1SMk6XEiwTbdDuRZOzNJh6wQ/MAVsF2WHiSw1GqPeis809yi5nW9 Cb/5SLDgKyzslhB01GAm42OzgtWr4lfg5w6M3r553HyVn2pChZSDUEx+ed9JUREQ UKtib27Wo9q4y3IhACieuD7M66p9oojoiNmTcdrygKIgFVhcXK7TLTfY4zUvD10y qybNlpbzDYM= X-Virus-Scanned: amavisd-new at mykolab.com Received: from mx.kolabnow.com ([127.0.0.1]) by localhost (ext-mx-out001.mykolab.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wZ7AV2wjKp7c for ; Mon, 29 May 2023 20:38:12 +0200 (CEST) Received: from int-mx003.mykolab.com (unknown [10.9.13.3]) by mx.kolabnow.com (Postfix) with ESMTPS id 8EADE520 for ; Mon, 29 May 2023 20:38:11 +0200 (CEST) Received: from ext-subm003.mykolab.com (unknown [10.9.6.3]) by int-mx003.mykolab.com (Postfix) with ESMTPS id 08B8C3698 for ; Mon, 29 May 2023 20:38:11 +0200 (CEST) Message-ID: <8d1da895-e5ac-15f7-d2f9-51d3a35dc63e@alec.pl> Date: Mon, 29 May 2023 20:38:09 +0200 MIME-Version: 1.0 To: internals@lists.php.net References: <799ae864-6e25-4196-a5ce-0d74600a8378@app.fastmail.com> <6aa0a33e-8b9f-d96b-bc42-de3b5d85936e@alec.pl> Content-Language: en-US In-Reply-To: <6aa0a33e-8b9f-d96b-bc42-de3b5d85936e@alec.pl> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] [Discussion] Clone with From: alec@alec.pl (Aleksander Machniak) On 29.05.2023 14:12, Aleksander Machniak wrote: > In "Property name expressions" section's first code example I think you > intended to do `clone $self` (not `clone $this`) inside the foreach() loop. > > Also, I have a feeling that it would be better to implement `clone > $object with $properties` syntax first and if that is accepted think > about expressions support. It's not a strong feeling though. Actually, with some more thought, my opinion now is that introduction of property name expressions is not justified. And will be a reason for me to vote No. I'm still not decided about which syntax I'd prefer, maybe you should do a poll with these basic options. Sorry, if there was one and I missed it. 1) clone $object with $properties; 2) clone($object, $properties); 3) clone($object, prop1: $var1, prop2: $var2); 4) clone($object, function ($clone) use ($properties) { foreach ($properties as $name => $value) { $clone->{$name} = $value; } }); 5) clone $obj with (prop1: $var1, prop2: $var2); note: $properties is iterable note: in 2-4) brackets are potentially optional. note: imho, 5) is similar to 3), but worse. -- Aleksander Machniak Kolab Groupware Developer [https://kolab.org] Roundcube Webmail Developer [https://roundcube.net] ---------------------------------------------------- PGP: 19359DC1 # Blog: https://kolabian.wordpress.com