> On Dec 2, 2025, at 1:38 AM, Larry Garfield <[email protected]> wrote:
> 
> Hi folks.  Ilija and I would like to present our latest RFC endeavor, 
> pattern matching:
> 
> https://wiki.php.net/rfc/pattern-matching
> 
> You may note the date on the RFC is from 2020.  Yes, we really have had this 
> one in-progress for 5 years. :-)  (Though it was inactive for many of those 
> years, in fairness.)  Pattern matching was intended as the next follow up to 
> Enums, as it's a stepping stone toward full ADT support.  However, we also 
> feel it has enormous benefit on its own for simplifying complex comparisons.
> 
> This RFC has been through numerous iterations, including a full 
> implementation rewrite just recently that made a number of features much 
> easier.  We have therefore included two patterns that were previously slated 
> for later inclusion but turned out to be trivially easy in the new approach.  
> (Variable pinning and numeric comparison.)
> 
> Nonetheless, there are two outstanding questions on which we are looking for 
> feedback.
> 
> Naturally given the timing, we will not be calling a vote until at least late 
> January, regardless of how the discussion goes.  So, plenty of time to 
> express your support. :-)
> 
> --
>  Larry Garfield
>  [email protected]

Thank you for the RFC and that you included option with match and individual 
IS’s, I think it would be preferable option not to break the match 
construction. 

Regarding the patterns, is there a way to declare and reuse the patterns? 
Assign it to a variable and use it as “is $pattern” or something like that. 
Maybe as a separate class “$pattern->match($var)”. 
While it’s not reusable it looks like it has a limited scope to use it, 
otherwise regular replacements preferred. 



-- 
Best regards, 
Dmitrii Derepko. 
@xepozz

Reply via email to