Re: Introduce the abiltiy to use the first-call-callable syntax on non-static methods, statically

From: Date: Mon, 23 Jan 2023 17:31:26 +0000
Subject: Re: Introduce the abiltiy to use the first-call-callable syntax on non-static methods, statically
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-119404@lists.php.net to get a copy of this message
On Mon, Jan 23, 2023, at 10:53 AM, Ollie Read wrote: > There's definitely similarity, but I would say it sits somewhere > between the two. Rather than reference a partial method call, or create > a closure for a method, you're delaying a method call. Or rather, > referencing a method. We have the ::class pseudo property, so I see > this like an equivalent, but for methods. So what you're really looking for is a shorter way to write this: foo(fn(Str $s) => $s->beep()); Now you're definitely in the realm of PFA, pipes, and that kind of functionality. And, sadly, Internals has shown a great deal of resistance to that kind of functionality. I have a user-space implementation of pipes that includes utilities to do something similar[1], but most functional languages I know also don't have a really strong native way to "turn around" a call like that. I'd love a solution for that, but so far it has proven both elusive and controversial. --Larry Garfield [1] https://github.com/Crell/fp/blob/master/src/object.php#L28

« previous php.internals (#119404) next »