Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115219 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 42883 invoked from network); 29 Jun 2021 17:45:20 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 29 Jun 2021 17:45:20 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id CAED21804CC for ; Tue, 29 Jun 2021 11:05:23 -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 out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 29 Jun 2021 11:05:23 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 6CFDA5C0292 for ; Tue, 29 Jun 2021 14:05:23 -0400 (EDT) Received: from imap43 ([10.202.2.93]) by compute1.internal (MEProxy); Tue, 29 Jun 2021 14:05:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding: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=TV+NR1nfwdfrHW5PnrJYOdSVBFq3zfWaB2XJisb6O ZE=; b=vX/A86UxTgKyRvRyJcATrHbh4M6zBVBHp/K97PzVw7C57DfMK6ZuIqN5P UyBaenK2QJi+CUs7XzekIukt7U8ougRHvCMuzmiOLvhi0ipFLRTwxd7185xASikp DuP33kDBul62E2Gtxs8fpdsNNs8yEYeHEUDzpSSTKj3xgLhUdWwtKr5m9JCEHGL2 jAJAZo4AaglSr8Jn15h3KER4hIoY7UAeyUJUmsTNMwj3sk2aIWHHES2QvDubXeWk XwomAR2tvCE2XXGxgekFVAdotpY1fCj3RAum9/JiJp/FlrATh3TEgYe1kbdKWZ4X DCjDx0P+4hgal/yne1HVpOqBpm93Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeeitddgkeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgfgsehtqhertderreejnecuhfhrohhmpedfnfgr rhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtg homheqnecuggftrfgrthhtvghrnhepffffffejffdugfegvedviedttedvgfejffefffej leefjeetveehgefhhfdvgfelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 418DFAC0073; Tue, 29 Jun 2021 14:05:23 -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: <9f0c9565-22e1-4d94-bef5-cfc44ce02dc5@www.fastmail.com> In-Reply-To: References: <222b3921-3d9b-47f9-8d13-e6a123f36fad@www.fastmail.com> Date: Tue, 29 Jun 2021 13:05:03 -0500 To: "php internals" Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [Vote] Partial Function Application From: larry@garfieldtech.com ("Larry Garfield") On Tue, Jun 29, 2021, at 1:00 PM, Larry Garfield wrote: > On Tue, Jun 29, 2021, at 12:30 PM, Guilliam Xavier wrote: > > (Extracted from the "Pipe Operator, take 2" thread) > >=20 > > On Tue, Jun 29, 2021 at 12:54 AM Larry Garfield > > wrote: > >=20 > > > On Mon, Jun 28, 2021, at 5:30 PM, Olle H=C3=A4rstedt wrote: > > > > > > > Would a slimmed down version have more support? How about removi= ng the > > > > variadic operator, and let the user manually add the lambda for = those > > > > cases? > > > > > > I talked with Joe about this, and the answer is no. Most of the > > > complexity comes from the initial "this is a function call, oops n= o, it's a > > > partial call so we switch to doing that instead", which ends up in= teracting > > > with the engine in a lot of different places. > > > > >=20 > > Are you saying that the implementation complexity is mainly due to c= hosing > > a syntax that looks like a function call? > > If yes, is it also the case for the "First-class callable syntax" RF= C? > > And does it mean that a different syntax (e.g. with a prefix operato= r) > > would result in a simpler implementation? >=20 > From what I understand from Joe, most of the complexity comes from=20 > producing something that isn't a closure but shares the same interface= =20 > as a closure (at least that's what it would be in PHP terms), which=20= > then requires lots of special handling throughout the engine. I don't= =20 > fully understand it all myself, TBH. >=20 > I've been pondering if a completely different approach with a prefix=20= > symbol would be able to be less complex, and the simple answer is I=20= > have absolutely no idea. But we are running low on symbols... Ah, I found the technical details that Joe gave me (right after I hit se= nd, of course). Quoting Joe: "the engine expects certain things to happen, and is designed and then o= ptimized around those assumptions ... for example, a stream of INIT, SEN= D, DO_FCALL is not meant to be interrupted, the first fundamental change= you have to make is making the engine aware that stream of INIT, SEND, = + are not always followed by DO_FCALL " So yes, it sounds like hooking into the function call process is where t= he complexity comes from. Which suggests that an approach that works us= ing a different syntax that desugars to a closure would avoid that issue= , but then we need a syntax that wouldn't be ambiguous, and that's getti= ng harder and harder to find. (Nikita's first-class-callables RFC notes= some of the issues with available symbols, and they're essentially the = same for partials either way.) And I've been told that creating closure= s in the AST compiler is Hard(tm)... --Larry Garfield