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

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to