Re: [RFC] Partial Function Application for instance of non-static methods ("$this")

From: Date: Sat, 31 Jan 2026 04:25:53 +0000
Subject: Re: [RFC] Partial Function Application for instance of non-static methods ("$this")
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-129963@lists.php.net to get a copy of this message
Oh, I should scroll past the implementation section. On 31.1.2026 05:21:12, Bob Weinand wrote:
Hey Tim, On 22.1.2026 10:50:26, Tim Düsterhus wrote:
Hi Arnaud and I would like to start discussion on our RFC “Partial Function Application for instance of non-static methods ("$this")” which is intended to round-off the Partial Function Application RFC that was accepted recently: https://wiki.php.net/rfc/partial_function_application_this Best regards Tim Düsterhus
I've been thinking about this RFC and I think it's a good addition. I just have one question: Why "$this: $obj" and not "this: $obj"? The variable in the function is "$this". Just like "$arg", which gets passed as "arg: $value", without the extra leading dollar-sign. (There's also no conflict, as you may not redeclare $this yourself in a non-static method.) When I see $<varname> before the colon, I sort of expect a dynamic parameter name, but it's not. Thanks, Bob
I see the rejected features section, but this is a non-argument to me, like x(...['$this' => $obj]) is just allowed the same currently. I don't think that argument weighs strong enough. Bob

« previous php.internals (#129963) next »