Re: Uniform Function Call Syntax
On Thu, Apr 3, 2025, at 8:52 PM, Yakov Lipkovich wrote:
> Hello,
>
> I would like to gather interest in adding Uniform Function Call Syntax
> (UFCS) to the PHP language. In short, it allows to call any static
> function f($a)
as $a->f(...)
. The ...
is required
> because not all
> functions have the desired parameter in the first position. Outlined
> below are some benefits of this syntax.
Welcome.
I recommend having a look at the Pipes thread[1], especially the last week or so of messages, where
we're discussing something very close to this. My most recent message touches on this as well
toward the end.
In short, it's not realistic to "bolt on" such a universal approach to a language as
mature as PHP. However, using pipes, partial application, and/or extension functions we can get to
something that feels very similar, and that's already being worked on. (More details in that
thread.)
Cheers.
--Larry Garfield
[1] https://externals.io/message/126318
Thread (3 messages)