On Thu, Jan 22, 2026, at 10:08 AM, Tim Düsterhus wrote:
> Hi
>
> Am 2026-01-22 16:33, schrieb Derick Rethans:
>>> 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.
>
> Yes, it certainly requires some getting used to it. It's the best we 
> could come up with, but if there are any better suggestions, we're open 
> to hearing those. I'd like to note the “Rejected Features” section, 
> since it lists some non-workable alternatives we considered.

I too am very much in favor of this functionality, though not a fan of the 
syntax either.

My previous, un-finished thinking was for `$$->foo('blah')`, which would 
translate to a mixed fn that just forwards the call.  I... hadn't actually 
thought about also partially applying the method, since the use cases I can 
think of would all be "call this method on the value piped from the previous 
pipe step."  (Or, read this property.)  That would allow it to be embedded 
within an array_map() call or similar, since it's technically independent of 
both PFA and pipes.

If it's being partially applied, then I don't see a way around the redundant 
typing, which is annoying.  At least not without vastly better type inference 
than we have today.

So, I think I am mainly interested in the degenerate case where $this is the 
only thing being partially applied, which seems like a common enough case that 
it could have a nicer version?  I'm just spitballing at this point, I think.  
But I do like the direction.

--Larry Garfield

Reply via email to