Re: Uniform Function Call Syntax

From: Date: Fri, 04 Apr 2025 04:40:32 +0000
Subject: Re: Uniform Function Call Syntax
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-127039@lists.php.net to get a copy of this message
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

« previous php.internals (#127039) next »