Re: [Early Feedback] Pattern matching
| From: | Thomas Bley | Date: | Thu, 20 Jun 2024 20:29:28 +0000 |
| Subject: | Re: [Early Feedback] Pattern matching | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-123710@lists.php.net to get a copy of this message | ||
> Larry Garfield <larry@garfieldtech.com> hat am 20.06.2024 19:38 CEST geschrieben:
>
>
> Hello, peoples.
>
> Ilija and I have been working on and off on an RFC for pattern matching since the early work on
> Enumerations. A number of people have noticed and said they're looking forward to it.
>
> It's definitely not going to make it into 8.4, but we are looking for early feedback on
> scoping the RFC. In short, there's a whole bunch of possible patterns that could be
> implemented, and some of them we already have, but we want to get a sense of what scope the
> zeitgeist would want in the "initial" RFC, which would be appropriate as secondary votes,
> and which we should explicitly save-for-later. The goal is to not spend time on particular patterns
> that will be contentious or not pass, and focus effort on fleshing out and polishing those that do
> have a decent consensus. (And thereby, we hope, avoiding an RFC failing because enough people
> dislike one little part of it.)
>
> To that end, we're looking for *very high level* feedback on this RFC:
>
> https://wiki.php.net/rfc/pattern-matching
>
> By "very high level," I mean, please, do not sweat specific syntax details right now.
> That's a distraction. What we're asking right now is "which of these patterns
> should we spend time sweating specific syntax details on in the coming weeks/months?" There
> will be ample time for detail bikeshedding later, and we've identified a couple of areas where
> we know for certain further syntax development will be needed because we both hate the current
> syntax. :-)
>
> If you want to just read the Overview section for a survey of the possible patterns and our
> current recommendations, you likely don't need to read the rest of the RFC at this point. You
> can if you want, but again, please stay high-level. Our goal at the moment is to get enough
> feedback to organize the different options into three groups:
>
> 1. Part of the RFC.
> 2. Secondary votes in the RFC.
> 3. Future Scope.
>
> So we know where to focus our efforts to bring it to a proper discussion..
>
> Thank you all for your participation.
>
> --
> Larry Garfield
> larry@garfieldtech.com
Thank you!
> $var is *; // Matches anything, more useful in the structure patterns below.
maybe also consider:
$var is mixed; // Matches anything, more useful in the structure patterns below.
> // Array application, apply a pattern across an array
> $foo is array<strings>; // All values in $foo must be strings
> $foo is array<int|float>; // All values in $foo must be ints or floats
+1
Regards
Thomas