Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127416 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 A00A31A00BC for ; Wed, 21 May 2025 15:18:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1747840587; bh=o+Sl/ZdaeMFljwUYuH5OYnu042iQwgFCLFmTWpe5h9s=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=V6yZsqD8TWs3AMGyLOXeAZFi/a0LIRQYEPcvolP5MlaBg/xLDhM0X37zFNrN7jJLw dKhrOtPQA+VAId7e6Lplps2oDlHv/8eBRw1Ta/IUvJmt9diAxk0vOshlkNMIo1PlkF vN8HLMdojZPLXg6jj49yu16B2iia8/P8z/K38/MzU5zh0F7VFuZFxxtTGGNBxndklP GNCAW93XLKCJm5oH0pxWQkjLHPs+FEtOzoqHXTH+RLAA8+bROArxjn+YUovFdVX0u7 Q1SYGiLskQoKDh5sDnNmFPVd67ffsJbDgxfYz0DqCptSglnCIjWzbjIxwimuUscH36 YCi907qj1rgBA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 18097180059 for ; Wed, 21 May 2025 15:16:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-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,DMARC_PASS,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (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, 21 May 2025 15:16:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1747840711; bh=Xm9YdKUeGv12es1JjdSDTW4YzpQo0PxXVOf93JmaAq0=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type:from:to:cc:subject:message-id; b=An5tzdzJg8QOCFpVXnweR2gY43gxp8mtEE/UsR7qdNeUCC7+2pUiL+YxPpkPeu2S9 7dDNZgt+frUDrrRr8uN3FlvanciUHfoeUo6/dW0WlTeOhY7OjUiiZ2vDs8thIxhPw1 PFCUpygiSuVpdV+w4BPsg/81hewR1NFxnC1z4YVTgsOuw7QhV0L6wVBbtHFJFOIReU +h1aYbm/+Z7Ap2AFWOgQIpVJ9uIs6cUx1qJzF0e3MBE8QTzQZ8AE/3gwcSy2SHicho gUiCEKTT/MXb8CMO7Qyema6CWBKollWPv4e1K/GQMMAx9Y21q9lZRCbBNqNcPVr/uF ri5k5NvFCTaVA== Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Wed, 21 May 2025 17:18:31 +0200 To: Nicolas Grekas Cc: Volker Dusch , php internals Subject: Re: [PHP-DEV] Re: [RFC] Clone with v2 In-Reply-To: References: <2f30cae4add309021e18d0f359a1814e@bastelstu.be> Message-ID: <2feafbbf25d7d0cd724af53491b479b7@bastelstu.be> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=) Hi Am 2025-05-21 16:27, schrieb Nicolas Grekas: > Thanks for sharing your insights. This looks a bit far reaching for the > RFC. Making `array()` a function / allowing named parameter syntax with `array()` would be a separate RFC. > On my side, my opinion is: don't make clone a function call. I've never > missed not being able to call clone as a callback. It's trivial to > write a > short function using the operator when in need. It's an intentional design goal of this RFC to borrow the function call syntax to avoid inventing something that does not yet exist in PHP and to avoid blocking additional keywords (“with”). Making `clone()` an actual function greatly simplifies the implementation, since all the heavy lifting around parameter parsing is already provided by the engine [1] and it also ensures that the behavior is consistent with the behavior implied by the used syntax. If the second parameter would be a regular array rather than using the named parameter syntax, making clone() a function would not be necessary (but wouldn't make things harder either). Best regards Tim Düsterhus [1] As an example, with the currently proposed named parameter syntax, unpacking arbitrary Traversables with `clone($obj, ...$traversable)` would need to be reimplemented specifically for `clone()`.