Re: Pattern matching details questions
| From: | Larry Garfield | Date: | Tue, 04 Feb 2025 21:25:34 +0000 |
| Subject: | Re: Pattern matching details questions | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-126289@lists.php.net to get a copy of this message | ||
On Tue, Feb 4, 2025, at 3:16 PM, Larry Garfield wrote:
> Patterns are deliberately designed as a superset of existing DNF types.
> You can already have a type of Foo&Bar, so we want the pattern for
> "instanceof Foo || instanceof Bar" to be the same. That means & and |
> for conjunctions is necessary. Also supporting "and" and "or" would
> technically be possible, but wouldn't resolve the issue (since & would
> still be needed either way) and would just add more complication,
> confusion, and inconsistency. I don't think that's viable.
And that of course should be "$x instanceof Foo && $x instanceof Bar" in the
equivalent example. My bad. (Though the point applies for |, ||, or, just the same.)
--Larry Garfield