On Tue, Dec 2, 2025, at 10:32 PM, Dmitry Derepko wrote:
>> On Dec 3, 2025, at 12:03 AM, Larry Garfield <[email protected]> wrote:
>> 
>> $filtered = array_filter($arr, is Point(x: <10));
>
> Btw, it looks incorrect and short closure is preferable here
> array_filter($arr, fn($x) => $x is Point())

As I said, that's not actually a syntax I'm proposing.  Just spitballing that 
it would be nice to be able to remove the `fn($x) => $x` boilerplate at some 
point.  But that's not for this RFC; for now, the fact that you can wrap a 
pattern up into a short closure is sufficient for reuse.  

> Or if it works with DFA
> array_filter($arr, ? is Point())
>
> If your example illustrated a pattern as an argument I think it’s not 
> valid case, because a pattern is something after “is”? The point, 
> enumerated types or values. And “is” here is an 
> action/function/intention to match left and right operands. 
>
> But kotlin style is perfectly matched here
>
> array_filter($arr, { $it is Point() })

Ilija would agree with you, and has been arguing for a { $0 + 3 } type syntax 
for extra-short closures for a while now. :-)  But that's not in scope for the 
moment.

--Larry Garfield

Reply via email to