Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127934 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 2504B1A00F6 for ; Mon, 7 Jul 2025 15:35:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1751902426; bh=g+2X/6DwRXq5tFiRRYiVhpkYOGe+GNog2PPnfF7823U=; h=Date:From:To:In-Reply-To:References:Subject:From; b=SnczdXamqlo/v48/PkU3vIVyD/8h39FZEsl2dyy2De+cW0SgCJI2JwHfKCxol0R/5 RcBaXIWs+hL+9nBfvI3yV13zcgZIsGgHV+FT8UqgctnDc9mDlCgfgSWLYH25HxbHeN 0daApN2fHGEho4P1Hw4flYRhRH1WHDbDFEt5AWBfURDg99Nf74OXvmyyi87K1KZLxZ f8tP0u7NAJT62IkBecAQZLSrj062+HysL8ZkoPnHHnt1bCZmNK1fQJu0vaJdRjg/zt Olxly/6UDnMMoPsHclzlCCY5Ox5GGqk2hP5ko0QygBi6AVqQIbyKvmaE07oCgSZNK5 xfqp0ZSv2JQcA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 349971805C7 for ; Mon, 7 Jul 2025 15:33:44 +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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_NONE 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 fout-a5-smtp.messagingengine.com (fout-a5-smtp.messagingengine.com [103.168.172.148]) (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 ; Mon, 7 Jul 2025 15:33:42 +0000 (UTC) Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfout.phl.internal (Postfix) with ESMTP id 8AD23EC0453 for ; Mon, 7 Jul 2025 11:35:32 -0400 (EDT) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-10.internal (MEProxy); Mon, 07 Jul 2025 11:35:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=fm2; t=1751902532; x=1751988932; bh=aj5Q6dYqDNuA1df2HHwPh r8ow5PWvoBcYUZ5Ky6KdwA=; b=IN6r6wourII0tPGSSdt4X+oGdpU/8C0Li97s7 n5jUc619gsNLtFGBIcE57jZxNDOqUHgVoXbdSHZPzHVqWvXU0ycv5Ux75f11QW11 j7ZJn7k4+NlCXXVICWdetXx8RJtySCLGf0OMBGsR3vU2IkfZvzHxAo6ttvF5NrPo x1L/Saw7BTGW7GHYpuDHaE7qxKuFNDMIJ9cWWGk9+AT+qN3unlXwDEMFoDhGQoNE QU7Lq1Ql6jI2+iCxBXVUWW1kFJ7pL1Tmor+yvYe2XGFfuvLP1qCLkfwsi1KHg0vc Sa1aX3nVMG/R+PgV17AGZOnbcof1vJBlDGCY9Q1xD6y9LlCRg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1751902532; x=1751988932; bh=a j5Q6dYqDNuA1df2HHwPhr8ow5PWvoBcYUZ5Ky6KdwA=; b=JyEDZr4mXP9NUoE9a rqqLRAxgUZXYM2htNMe2Eg5mT9Y6ebfavpsOvXl5btkOPwyE64ImsJEBur1HCC/L pEwg5AY/RQWmS3MClNB7lfSpcXcFrnJWLpEG5sVUdJ1K7+QjnBtqchZcjwrFiN8m mYfs7IUYzF8tq59oYWriDiliK1+UqCIO1cXpB6lOzLQiTaPatQCiNwC26h8OvDQl AqPJRemF+6PfxprgrdEhBeSMkQEfxR+Vm4Ptt5uPGrmPyyhO2xXUKbf8F2PJAKsM cBaONwGRlSC74l/Jh2khPM1Cw2msrNEQCUZuPmPnM7zhEJqMKBi1x9KWCyXIAAs8 cmepA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdefvddukecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefoggffhffvkfgjfhfutgfgsehtqhertdertdejnecuhfhrohhmpedfnfgrrhhrhicu ifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomheqne cuggftrfgrthhtvghrnhepuefgteeijeeuveffudelhffhtefhkeevtdeuvefgffdvfeei vdetgfehveetleffnecuffhomhgrihhnpehphhhprdhnvghtnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhgu thgvtghhrdgtohhmpdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprh gtphhtthhopehinhhtvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 3E162700065; Mon, 7 Jul 2025 11:35:32 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: T7b7d29473ae5162b Date: Mon, 07 Jul 2025 10:35:09 -0500 To: "php internals" Message-ID: <10c70b6b-6060-4dd2-8169-fa01890632cb@app.fastmail.com> In-Reply-To: <6a9d4f24-65e4-40ee-bf16-9b1120486d83@app.fastmail.com> References: <6a9d4f24-65e4-40ee-bf16-9b1120486d83@app.fastmail.com> Subject: Re: [PHP-DEV] [RFC] Partial Function Application v2 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Fri, Jul 4, 2025, at 5:27 PM, Rob Landers wrote: > On Sat, Jun 28, 2025, at 07:06, Larry Garfield wrote: >> Hi folks. Arnaud and I would like to present take-2 at Partial Funct= ion Application. >>=20 >> https://wiki.php.net/rfc/partial_function_application_v2 >>=20 >> It is largely similar to the previous PFA proposal from 2021, though = there are a number of changes. Most notably: >>=20 >> * The implementation is simpler, because FCC already did part of the = work. This RFC can build on it. >> * Constructors are not supported. >> * But optional arguments and named placeholders are supported. >> * It includes pipe-based optimizations. >>=20 >> Note: We realize that this is a non-trivial RFC coming late in the cy= cle. We are proposing it now because, well, it's ready now. If the dis= cussion goes smoothly, we're OK calling a vote on it for 8.5, especially= as it would complement pipes so well. If the discussion runs longer, w= e're also OK with targeting 8.6 instead. We'll see how that goes. >>=20 >> >>=20 >> --=20 >> Larry Garfield >> larry@garfieldtech.com >>=20 > > Hi Larry, > > I hope your trip through the trap door is largely uneventful with a=20 > smooth integration into 8.5. > > My only question: why does this implementation care if you specify too=20 > many arguments when PHP doesn=E2=80=99t care if you call a function wi= th too=20 > many arguments? > > I think it=E2=80=99s a good thing that it cares, and I think PHP itsel= f should=20 > care, but should this RFC change that expectation? > > =E2=80=94 Rob Largely because it conflicts with the intent of the closure author, and = may have unexpected interaction with optional args otherwise. Eg: function f($a, $b =3D 0) {} $f =3D f(?); $f(1, 2); Is 2 bound to $b ? If yes this goes against the intent of the PFA creato= r. But if not this is weird. Therefore it=E2=80=99s better if that=E2=80= =99s not allowed, as that's the least-weird outcome. If the closure author wants to allow trailing arguments, they can use th= e ... placeholder, which would allow for that. So: function f($a, $b =3D 0) {} $f =3D f(?, ...); $f(1, 2); It's self-evident that trailing args are allowed, and that it's the auth= or's intent, so in this case all is well and there's no (unexpected) wei= rdness. --Larry Garfield