Re: [RFC] Pattern Matching

From: Date: Mon, 26 Jan 2026 16:28:08 +0000
Subject: Re: [RFC] Pattern Matching
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-129932@lists.php.net to get a copy of this message
On Mon, Jan 26, 2026, at 7:33 AM, Morgan wrote: > On 2026-01-26 23:53, Bruce Weirdan wrote: >> >> >> On Mon, Jan 26, 2026 at 5:48 AM Morgan <weedpacket@varteg.nz >> <mailto:weedpacket@varteg.nz>> wrote: >> >> > On 2026-01-26 07:44, Larry Garfield wrote: >> > > >> > > With per-arm, you can opt-in to pattern matching individually, at >> > the cost of having to remember to repeat the keyword on every line. >> > With per-block, you only have to add the keyword once at the cost of >> > > not being able to selectively use patterns or identity matching. >> > > >> > > Which tradeoff is better is the option question.  (Ilija and I >> > disagree on which to go with.)  Or, if someone can suggest a way to >> > allow automatic detection reliably, that would also be most welcome. :-) >> > > >> > >> > If it had to be one or the other [...] >> >> >> Does it have to be one of the other though? Can't we have both? >> > > > > ...so the real question is if "match($foo) is {..." should be added > as a shorthand for when all matching is on patterns. It is technically possible to implement it both ways, I believe. Whether that is too confusing and messy is another question. --Larry Garfield

« previous php.internals (#129932) next »