Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129868 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 E2F941A0136 for ; Thu, 22 Jan 2026 16:42:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1769100141; bh=l6Dk/OMfJXyD44f5qguWgpkM9XWYzrFop/FGiV4yjJU=; h=Date:From:To:In-Reply-To:References:Subject:From; b=AsP3JcwIA2n85WZ+wp1Etm0sW3Jmf1r21+8aZXIFI1R/AHrGB/nubVz2MgQoQwq0J pBlFK/8G7tlCxhCKsn0nEsQxc4tOrT8EVw74o+3G8N6DTB7h+fphg6Rg0+5nHt/Wym DrayhLU3hME5OTRnUdWAX8X1k9EYJ2ApPGVjHuALdvGVZMx0uZ2cSz2xjhAAVi8Dva 5VSfHNA1DM6bQ/mE+51CshAvWfiaAxMuWki9877o/MkfvMLNV7NN/mK7KPMgKc3zY4 buHoHOoshLE1Ei3+Sjrxj7VUb9xESdXDAyvyLCe9xkIcVc5LkhUK7Vu8UVIvIPPlkN MLoQ5jGEpkVeA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D690C1805BA for ; Thu, 22 Jan 2026 16:42:19 +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=-0.1 required=5.0 tests=BAYES_50,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: No X-Envelope-From: Received: from fout-b3-smtp.messagingengine.com (fout-b3-smtp.messagingengine.com [202.12.124.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 22 Jan 2026 16:42:17 +0000 (UTC) Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id F37161D000AE for ; Thu, 22 Jan 2026 11:42:11 -0500 (EST) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-04.internal (MEProxy); Thu, 22 Jan 2026 11:42:12 -0500 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=1769100131; x=1769186531; bh=NxNmR04zIWD3IBzU/QEQz GBXw5kVCxnv6EeSRQgxCSA=; b=WH7orEP/bxLYMm8jE/yOeime3pcW0JQrv/mOz AKRLHkUforGTfQxkLnm3ek/W2zHhkrauHp7XhZD8Ay/Rsvg5Z7iyWMyV7ob0ne7w y4gSGIJFwG+L6XYFijgDH8TW53nJctkJCyHy3hhcbVu1Opon3ORioPmiB7W1fvXk vOyyJT9mNnqJTUArNGLQj/ChUhJe1Ogkp1s15Ex8HyWzTiMkZ8bLFhdrkTVzsBXp uSf7pu8g2DrdBIx61OXPMrLe2tfVtbfr5+bNtsuaeL90DMB4JeVWw+/CactoTHt1 Kj+r7BAjwGn3JnbicnJMtE6NJlXA3AC+K2ox8p5gM7y4V7txw== 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=1769100131; x=1769186531; bh=N xNmR04zIWD3IBzU/QEQzGBXw5kVCxnv6EeSRQgxCSA=; b=E7Y86JWmdpZqPCy6O pdk52UO5wQtifwpNuyB06eLUKl7Vhgns1l5vsxO4lRpl7Z9ZU2hWA43+aeFohW/G bj9LBkFUarquDGxnGrGq79tm0RGIAtzFAtw7xm2FWU9a5BBbBfF87M4n+On19/St vRxJewsh3FmRLLVeRzXN5AIq5nGMi5JTNkXY/HL+tYvOFBudtjAruF+qBFgCZRNM 1q3idwbod3nHyVo4irVWfXV1JBxWkerroOdqY7oPr3OrTjgmwQfzxF+m1eYiEIKo gFsN1U938HhuqmLU/aNX8vOWO16LyHprCmpIp00fzOcmEBRHO7y2b4iwOsFec+jR Dllxw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddugeeiieejucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepofggfffhvffkjghfufgtgfesthhqredtredtjeenucfhrhhomhepfdfnrghrrhih ucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmqe enucggtffrrghtthgvrhhnpeffieeivdfhvdeguddttdegteeiueegvefhteehfeeffeet udeitdehtdegjeeuieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomhdpnhgspghrtghp thhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepihhnthgvrhhnrghlsh eslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id A7C77700065; Thu, 22 Jan 2026 11:42:11 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: Ap5THxlW55h7 Date: Thu, 22 Jan 2026 10:41:51 -0600 To: "php internals" Message-ID: <62a90f31-697b-4607-a1ba-67956f5adfac@app.fastmail.com> In-Reply-To: References: <64953ec741a4c6609519e1878ad37b54@bastelstu.be> <253ee811-0c1d-7eab-4c36-38607401aaf6@php.net> <28461544eb11b41dce7c7563ad879e63@bastelstu.be> Subject: Re: [PHP-DEV] [RFC] Partial Function Application for instance of non-static methods ("$this") Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Thu, Jan 22, 2026, at 10:26 AM, Rowan Tommins [IMSoP] wrote: > On 22/01/2026 16:08, Tim D=C3=BCsterhus wrote: >> Yes, it certainly requires some getting used to it. It's the best we=20 >> could come up with, but if there are any better suggestions, we're=20 >> open to hearing those. I'd like to note the =E2=80=9CRejected Feature= s=E2=80=9D=20 >> section, since it lists some non-workable alternatives we considered.=20 > > > Looking at this: > > >=C2=A0PHP itself already has "ALGOL-style" declarations, for "const"= ,=20 > "global", and "static". > > I'm reminded of placeholders in PostgreSQL; the type is needed to choo= se=20 > overloaded functions and operators, so this doesn't compile (without=20 > extra metadata): > > Select do_something(?) as result > > Instead, you can insert a dummy cast to indicate the type: > > Select=C2=A0do_something(?::int) as result > > > The PHP equivalent would be something like this: > > $f =3D (DateTimeImmutable)?->format('c'); > > Or, slightly more readable but less consistent with casts: > > $f =3D (? as=C2=A0DateTimeImmutable)->format('c'); > > > That doesn't solve the second part of the problem though: > > >=C2=A0It would also not allow to reorder the parameters in the resul= ting=20 > Closure, which is an explicit feature of Partial Function Application. > > > I thought I'd throw it out there anyway in case it stimulates any othe= r=20 > ideas. More spitballing on my previous reply: class Test { public function stuff(int $a) {} } (Test)?->stuff(?); Translates to: fn(Test $__this, int $a) =3D> $__this->stuff($a); But if there's no partialing on the method side, it could get abbreviate= d to: (?)->stuff(4); Translates to: fn(object $__this) =3D> $__this->stuff(4); Because we don't need to know the type at compile time, and a method-not= -found error would still happen at runtime anyway if necessary. That wo= uld then be a lot easier to write in cases where you're just dropping a = $this->stuff() call into a pipe chain but want to receive $this. I'm not sure if that would also allow for reading properties with the sa= me syntax? --Larry Garfield