Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128207 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 6101E1A00BC for ; Thu, 24 Jul 2025 10:03:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1753351325; bh=ZkK4ly/9LaNlMHhuLjrUATCGsjAYGUnUrH1KJVfocYQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=VNcdGsWNpynEGYiA/0aWFwCT4oVsBSvYrNR8iDbJjLIYvsmtBfmLQKcDJ0JQIBU4V WMeVB29PBTW4LrJZBvA+mWjnukH8tM3JBjU0Lmy9fMpb4q2bH8/X6HzUAK6GkhAtbY xk/kp/3d9+TAHJz29+cNkk20WWtO/ud5Fn72QdSsGn8HvipqGE0vPxnkVyMH4p4hYX 5esM73ooWMoy3rPbZ6KRmtVM3PMtXFo2o2pEZAxFBSynORVSVZ4D1wyykP5nZ2EJpY TxapmCSdsPZX7bLbzAitcqiaYRFWZRUK+E1llTf3YfDaI/8Hglgp45SxCNDAF2OkHj B1gF2X/1ehIOA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1562E180068 for ; Thu, 24 Jul 2025 10:02:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) 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.1 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 ; Thu, 24 Jul 2025 10:02:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1753351428; bh=z1S3XwkrOWqtDHjtKDzp7AhS6Nd49C7l2A2oXytWIL8=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type:from:to:cc:subject:message-id; b=VBVc0IYlXRPnWszG7twy/gaX8sZCnIn40xTDcceU9vDmnMi+8be6o1guUHOWYmnyj WyYIch6mULr9u65GKGepeFT3pIIVZfXRSaNz13urtfWJDsR8hM4fb7tbbjGuAozqhO 4yEZnJjfxbmoIky7SG0oMxzrWlbhotgT3UtBC7Q6aoXgi08N+wchDm4dUC39u6SqZ8 xDTTjRP5SzB0tT14z1TiR3HRMr20oxu/VQZoMGQk4lsGXWGxIoIZCZ8ldvOzzmyLwU boXXx8lSpwBRvEYLsH3mmpxpCeqYUMpNHNbij1JetSskfB/9tEzNl1woLtcAy1GLNe gtf3u7hzck/5w== Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Thu, 24 Jul 2025 12:03:47 +0200 To: Larry Garfield Cc: php internals Subject: Re: [PHP-DEV] [RFC] Partial Function Application v2 In-Reply-To: References: <52dbe5236df460958644677c781513c3@bastelstu.be> Message-ID: <395ee57ca13b16ab09301f9bee6f07b9@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 I did not yet have the time to check the changes and your reply in detail, but I already wanted to follow-up on some of the points. Am 2025-07-23 15:55, schrieb Larry Garfield: > $c = fn(string $s, Point $p, int $m = 0) => stuff(1, $s, 3.14, $m); I don't think this is accurate? `$p` is unused. >> The choice of parameters names makes it hard to understand the >> examples, >> particularly when named parameters are used to provide arguments out >> of >> order. Including the “position” in the name of the parameter would >> make >> it easier to follow the example, since it is not necessary to look up >> the signature of `stuff()` all the time. (it becomes manageable if you >> read it as a sentence "is FPM") > > LOL. That was completely unintentional. :-) > > However, I have gone through and added numbers to the variable names to > clarify their original ordering. I believe you missed some. I'm still seeing a bare `$i` and also a `$4p` typo. Please double-check, possibly there are also other mistakes, I didn't check in detail. > So the same is true of a PFA: I don't think that necessarily follows, because for PFAs there are two parameter lists that are relevant: 1. The parameter list of the resulting Closure. 2. The parameter list of the original function. > foo(a: ?, b: 2, c: ?); > foo(b: 2, a: ?, c: ?); > foo(c: ?, b: 2, a: ?); > foo(?, 2, ?); > > All of those produce the same result. I don't think they should. Specifically the (1) and (3) should not. My expectation is that: $f = foo(a: ?, b: 2, c: ?); $f(1, 3); // calls foo(1, 2, 3); and $f = foo(c: ?, b: 2, a: ?); $f(1, 3); // calls foo(3, 2, 1); The order of the question marks should match the order of the parameters in the resulting Closure, which is not necessarily the order of the order parameters of the original function. Best regards Tim Düsterhus