Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114694 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 78992 invoked from network); 2 Jun 2021 17:34:32 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 2 Jun 2021 17:34:32 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A9AB3180211 for ; Wed, 2 Jun 2021 10:47:51 -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.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 2 Jun 2021 10:47:51 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 7D89F5C006B for ; Wed, 2 Jun 2021 13:47:50 -0400 (EDT) Received: from imap43 ([10.202.2.93]) by compute1.internal (MEProxy); Wed, 02 Jun 2021 13:47:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=zzUcFTuanPe8fhlQEvzXN3lXJ99c4 0rCFsdtnjn93s0=; b=cnAncM9rCWOGJxNRBCr4Aads0lBG0ELWhm6wz67mtld0V KgvvOjbS/gJf6VRWpgRIp1k90J6ZFsmGViIwkL6oMQe0/G6TOVU03/i6c1an7H9J QMexEWFaqUQ0XaJMzRG9QSb8gWczpN62AVnmmf38L8ZEngvWK+I/XWzDzWf4yTHq 30JjmiR02Q6SMOGay4FQycol6CdCCMUQ22Bs4vj7pKH0gqi5PRqqFhRnHCYkeLqc KedUgE8oCD2vMx+z24mXKVdIlkisrNvkFLqwnONCS+xPOj8F+p4EVVWcDh6XeYGK 2nWQ7ve4Alc36aLsaUmMlea/f5um+GgzcuhestECA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdeljedguddujecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfffhffvufgtsehttdertderredtnecuhfhrohhmpedfnfgrrhhr hicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomh eqnecuggftrfgrthhtvghrnhepgeehffeihfdtkeefveffueeiiefhjeduhfeuhfdtteel lefhvdejteekgffgueeinecuffhomhgrihhnpehphhhprdhnvghtnecuvehluhhsthgvrh fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesghgrrhhfihgv lhguthgvtghhrdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 01DDBAC0061; Wed, 2 Jun 2021 13:47:49 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-519-g27a961944e-fm-20210531.001-g27a96194 Mime-Version: 1.0 Message-ID: <9adf063b-2598-4dd4-9e2b-cf2cd4f53b86@www.fastmail.com> Date: Wed, 02 Jun 2021 12:45:15 -0500 To: "php internals" Content-Type: text/plain Subject: [RFC] Partial Function Application, take 2 From: larry@garfieldtech.com ("Larry Garfield") Hi folks. After much off-list discussion, iteration, and consideration, we have a new draft of PFA ready for review. The URL is the same: https://wiki.php.net/rfc/partial_function_application It's a bit long because we wanted to be as precise as possible. However, in short: * Partial application creates a closure object you can use like any other. * A ? indicates "exactly one required parameter here" * A ... indicates "zero or more parameters here" * If the pattern in the partial is compatible with the underlying function, everything "just works" * If it's not compatible, you get an error. * Named placeholders are not supported. * Splat (argument unpacking) is not supported. That gives us the 3 most important use cases, plus many others: arbitrary_function(...) works to reference any function safely. (This is what Nikita's mini-scoped proposal did.) some_func(1, 2, ?, 5) works to reduce any function to single-argument, which makes it useful in many callback situations. any_func($all, $params, ...) works to provide all the arguments to a function but not call it yet; you can then cal the resulting closure later with no arguments to actually invoke it. We're reasonably confident that we have all the ins and outs covered, and in a performant way. Because it's such a heavy rework, though, we want to give it enough time for the discussion to settle, so won't call a vote for at least 2 weeks from today (give or take the feedback we get here). Cheers! -- Larry Garfield larry@garfieldtech.com