Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120081 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 9247 invoked from network); 20 Apr 2023 14:39:43 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 20 Apr 2023 14:39:43 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 56E13180506 for ; Thu, 20 Apr 2023 07:39: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 ; Thu, 20 Apr 2023 07:39:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1682001579; bh=YnAfNd4sdN6bgj0InBKe8Gc4KsT+qh4U0uMxf16zF7U=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type:from:to:cc:subject:message-id; b=k2xGf+tYtnpsB31fukCnki+QM/z+bkSkBroAZ/VJZaq8+Ogt+hWPzqTVkYCFwpwiB /3D7YLzPgIrfURPeMOEGRzoR0Y3S+vhKn6yIURsVDqrfSIKW3LNvOlpyxuaXXRKYqW PDDZ1NZ7dKjL41KyBKTVimW3OQf8drWyXO/GGRNr/DImr2Psh2IPihBNl2pxhvQyNE xyHlG4nIaxO775Ka0pWnxiHgfPZ2E3BYSUUXzoVBFyMxRYoifnIhaNtwssrji+9y2t wCasTPbir7yk9a5P4dupnXg1/2TanSBJ5XYUItKspVyXH8k6WFd64ju6BiUxaLZnMs H8NRq689cvcpw== Message-ID: Date: Thu, 20 Apr 2023 16:39:37 +0200 MIME-Version: 1.0 To: internals@lists.php.net References: <687944e3-75ec-446b-bbd6-6d3d6856e864@app.fastmail.com> <1b842b25-c038-f647-67e1-b8c986b7d51d@bastelstu.be> <14DCA246-277A-44EC-B3A5-3809C5BCC7AA@gmail.com> Content-Language: en-US In-Reply-To: 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 4/20/23 16:17, Larry Garfield wrote: > On Thu, Apr 20, 2023, at 7:00 AM, Rowan Tommins wrote: > >> Rather than making everything use an array or array-like syntax, I >> would probably go the other way and scrap the special syntax for >> dynamic names, making the whole thing look like a function call, with >> support for array unpacking: >> >> $point = clone $point with (x: $x, y: $y, z: $z); >> $point = clone $point with (...['x' => $x, 'y' => $y, 'z' => $z]); > > I agree here, for all the reasons Rowan indicated. We already have a perfectly good syntax and semantics for named arguments that supports splat. Using that here would handle all the use cases we care about, including dynamic names, without any additional syntax. > FWIW I'm not too attached to my array proposal [1]. I would also be fine with Rowan's proposal of making the "with()" syntactically identical to a function call, if that's more agreeable. But please no entirely new syntax with braces as it currently is shown in the examples in the RFC. Best regards Tim Düsterhus [1] Though I still consider arrays to be more "natural" than named arguments.