Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114475 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 24184 invoked from network); 14 May 2021 21:40:21 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 May 2021 21:40:21 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4390E1804BD for ; Fri, 14 May 2021 14:48:55 -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=-0.0 required=5.0 tests=BAYES_20,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mercury.negativeion.net (mercury.negativeion.net [199.38.81.6]) by php-smtp4.php.net (Postfix) with ESMTP for ; Fri, 14 May 2021 14:48:54 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mercury.negativeion.net (Postfix) with ESMTP id 4FC1020D86A5DA; Fri, 14 May 2021 17:48:54 -0400 (EDT) Received: from mercury.negativeion.net ([127.0.0.1]) by localhost (mercury.negativeion.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id u4Ek1S2Wryma; Fri, 14 May 2021 17:48:54 -0400 (EDT) Received: from [10.0.1.101] (unknown [173.225.146.47]) by mercury.negativeion.net (Postfix) with ESMTPSA id D87A520D86A5CD; Fri, 14 May 2021 17:48:53 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) In-Reply-To: Date: Fri, 14 May 2021 16:48:53 -0500 Cc: internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: <1565EB81-57B7-49B0-A47C-342E0088A432@trowski.com> References: To: Mark Randall X-Mailer: Apple Mail (2.3608.120.23.2.4) Subject: Re: [PHP-DEV] [RFC] Partial function application From: aaron@trowski.com (Aaron Piotrowski) > On May 14, 2021, at 4:18 PM, Mark Randall wrote: >=20 >=20 > Passing more arguments than the partial defines would result in an = argument count error. >=20 I think it=E2=80=99s reasonable to allow passing more arguments to a = partial since user-defined functions and closures allow this without = error. Whether or not the extra arguments are automatically forwarded to the = function wrapped by the partial is debatable. Consider `function foo(int $x, int $y, int $z) {}` with a partial = defined as `$partial =3D foo(?, 42)`. If the partial is called as `$partial(73, 8)`, should 8 be forwarded to = `$z` or should the call error as providing too few arguments? Or perhaps = should the partial declaration should error, as it should have been = `foo(?, 42, ?)` or `foo(?, 42, ...?) so the partial provided all = required arguments to foo. Cheers, Aaron Piotrowski