Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115176 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 95878 invoked from network); 28 Jun 2021 15:48:06 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 28 Jun 2021 15:48:06 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 75AC2180539 for ; Mon, 28 Jun 2021 09:07:52 -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,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) (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 ; Mon, 28 Jun 2021 09:07:51 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 3F39E32008FB for ; Mon, 28 Jun 2021 12:07:50 -0400 (EDT) Received: from imap43 ([10.202.2.93]) by compute1.internal (MEProxy); Mon, 28 Jun 2021 12:07:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=//iJtc Ruo22q9yMd32VOeA6G+Q6+iNDMyZuagbdIzMA=; b=VQqd3Q40THFy4C33Pn9IvQ 18HA/Yk7TlwFoE0KIpAcqjSdKoYWN/hbvQS51COwoEN8LFEyNgoNDDJYQNbXkMZZ YpSiqnf71hCIuYA6pBUar2AfFwwrfjQ7U7vTBnO1jspzspwYjFEj9dd8WTCHrtTe vbBHug8L8nU6auGehD7kEhCTpWLVjlWrBamdH7sVA2sQUTAUA/6FU/rhAMPIGRc+ AEYj73yB73rYUlsNaJqxfFT6JY2VNCk5zHa4Pat6VR1e/3KIOxBgEGc6PJYzZDy9 bXNgL7d9thPKdupB1i8dcJyX2K/ypwm5RsgXNYsBCL0tn0HevcZozel8qqoBYP5g == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeehgedgleeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdfnrghr rhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtoh hmqeenucggtffrrghtthgvrhhnpedtuddtjeevveevgfekffelfeejffeuieduheevlefh tdejgfefgeehkeevieetleenucffohhmrghinhepughotghsrdhrshdpthhiugihvhgvrh hsvgdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhr ohhmpehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomh X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 8CEFEAC0073; Mon, 28 Jun 2021 12:07:49 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-530-gd0c265785f-fm-20210616.002-gd0c26578 Mime-Version: 1.0 Message-ID: <902c3642-70d9-4707-b76a-41eec81ba5a3@www.fastmail.com> In-Reply-To: References: <222b3921-3d9b-47f9-8d13-e6a123f36fad@www.fastmail.com> <45b16626-2b04-404b-f5f9-2430004bbdc8@telia.com> Date: Mon, 28 Jun 2021 11:07:29 -0500 To: "php internals" Content-Type: text/plain Subject: Re: [PHP-DEV] [Vote] Partial Function Application From: larry@garfieldtech.com ("Larry Garfield") On Mon, Jun 28, 2021, at 9:52 AM, Nikita Popov wrote: > These were just some notes on implementation details, they don't really > impact my overall opinion of the RFC. I should also say that I'm not > strongly opposed here, I'm just not convinced this is worthwhile :) The > complexity of the feature would be rather easy to overlook if I felt the > functionality was important. > > I myself think one should take into account that this is a feature > > that would make PHP stand out even more. Not being a follower of > > other languages here :-) > > > > Heh, it's the other way around for me: This just makes me more > apprehensive. Is there some special property of PHP that makes this feature > more relevant to us than other languages? All other mainstream languages do > well without this feature, so why do we need it? > > Regards, > Nikita It depends what you mean by mainstream. Ruby has a left-to-right-only version with an ugly syntax. I just discovered there's a 3rd party macro for Rust that... looks an awful lot like this RFC: https://docs.rs/partial_application/0.2.0/partial_application/ (I didn't spot it before because it's not part of the base language.) I didn't think to look for R before, but apparently there's some kind of support there? (I know nothing beyond what this page has.) https://purrr.tidyverse.org/reference/partial.html Most functional languages have some version of it, although generally left-to-right only. Which doesn't work when most of our standard lib was built without that in mind, so parameter order is not really convenient in most cases. Javascript doesn't have it natively, but there are 3rd party libraries that try to do it. Python is the same. There are also existing 3rd party libraries to do partial application in PHP, but they're slow and clunky and no one markets them. :-) Also, with only two exceptions (Rust and Go), most "mainstream" languages were developed long before the current trend of integrating functional features into more languages. (Rust has some solid functional features. Go actively avoids features as a design choice.) So yes, this RFC would give PHP a more robust and flexible version of PFA than most other widely-used languages. But that doesn't mean PFA is some obscure unknown feature that no one ever uses. It's a valid feature that has been creeping into non-FP-centric languages slower than many would like, but it's hardly fringe. --Larry Garfield