On Thu, 22 Jan 2026, Tim Düsterhus wrote:

> 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

        We propose allowing a named parameter $this: ? to be combined with the 
        “scope resolution operator” syntax of referring to a method.

I can't say I am entirely sold on the syntax here — starting with a $ 
makes it look like a variable.

        Since the $this: ? parameter does not refer to a parameter in 
        the underlying argument list and thus there is no ambiguity with 
        regard to positional parameters it may be placed at any position 
        of the parameter list 

I think I would be keen on *requiring* this to be the **first** in the 
argument list.

Although there is no ambiguity, I also can't see why you would want to 
have it anywhere else.

And the RFC does acknowledge "instance methods which effectively carry 
an implicit $this parameter that is provided on the left side of the -> 
operator."

With both these two above comments, I think I would like to see a better 
syntax — but I am unsure if that's possible.

        It may also not be used when partially applying an instance 
        method with a known object.

        $c = $dateTime->format($this: ?, "c"); // Fatal error: Invalid use of 
$this placeholder

Can you explain (in the RFC) what you mean by "known object" — I don't 
think the language on what this means is clear enough.

cheers,
Derick

Reply via email to