Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120470 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 69877 invoked from network); 30 May 2023 16:58:43 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 30 May 2023 16:58:43 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 785411804BC for ; Tue, 30 May 2023 09:58:42 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS24940 176.9.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (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 ; Tue, 30 May 2023 09:58:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1685465920; bh=z2nnqTtv8XN/47BCLFsijtb38lm0QT+HNIkcT4yAwk0=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type:from:to:cc:subject:message-id; b=mwMbEcFmfTerK12wDes0INd2mXqJ6TMVWBpAJtOjaZ7ggIUGr5+pf7XmXgpP2Q9fR 0W14PWIWCwnlkui7AHX4SHlfmpTG62TT9Ql9I51GWzTkHpRN/y5auJ0Yp41PaEu6Ew HFsNjS0INddFdCNKUTppu40PPqV+HznGbDMniTQNqYkXsor71rUTQmOjYw7kUnfKLC kKBpRUYY36dw9AeVYkIuhtwoJOXw/p8eUSQ8+nrCx1XjuGf3Cl4R4abkFBuDONYf8c 3ljjQKQbRPhbyTxeQ2fY1K9BQDfoqal8fbIp90iXrbyx/qJv4qYPaUxgafurRjOhmC AF+HyCccEDXYA== Message-ID: <8f69d5cb-0d17-9794-ad11-d07ac5d1a87d@bastelstu.be> Date: Tue, 30 May 2023 18:58:39 +0200 MIME-Version: 1.0 Content-Language: en-US To: internals@lists.php.net References: <799ae864-6e25-4196-a5ce-0d74600a8378@app.fastmail.com> <280bcea8-9483-4191-80d3-81763a988290@app.fastmail.com> <5db38bc4-a6fd-4cb7-b10d-3ad1a590888c@app.fastmail.com> In-Reply-To: <5db38bc4-a6fd-4cb7-b10d-3ad1a590888c@app.fastmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [RFC] [Discussion] Clone with From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=c3=bcsterhus?=) Hi On 5/30/23 18:37, Larry Garfield wrote: >> To be honest, the current behavior seemed like the natural choice for >> me, and I didn't really consider to execute the __clone() method after the >> clone assignments. >> Do you have a use-case in mind when you need to forward-pass information to >> __clone()? > > Not a specific one off hand. It's more a conceptual question. `with` has more contextual awareness than __clone(), so it should have "first crack" at the operation, so that if necessary it can make changes that __clone() can then respond to. The inverse doesn't make sense. > > The only reason for `with` to come after would be to allow `with` to "override" or "undo" something that __clone() did. Generally speaking, if you have to undo something you just did, you shouldn't have done it in the first place, so that's a less compelling combination. > > This one isn't a deal breaker, but we should be sure to think it through as it's kinda hard to reverse later. FWIW if I would've create the implementation, I intuitively would also have chosen to first execute __clone() and then set the properties. Of course this isn't a well-argued reason to do it this way, but I wanted to share it nonetheless. Best regards Tim Düsterhus