Re: Empty subject in match and switch constructions

From: Date: Mon, 03 Feb 2025 07:01:04 +0000
Subject: Re: Empty subject in match and switch constructions
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-126274@lists.php.net to get a copy of this message
On Sun, Feb 2, 2025, at 7:40 AM, Ilija Tovilo wrote: > Hi Dmitrii > > On Sun, Feb 2, 2025 at 1:05 PM Dmitry Derepko <xepozzd@gmail.com> wrote: >> >> I’m thinking about making match (true) and switch (true) be more lightweight by removing >> the subject “(true)” and making matching “true condition” by default. >> So $var = match (true) { … } can be used as $var = match { … }. > > There's an old RFC draft for this that never went anywhere. I believe > the feedback was mixed, but there's no way to know how it would have > turned out since it never went into voting. Given it's inactive, it > should be ok for you to take over. > > https://wiki.php.net/rfc/short-match > https://externals.io/message/112496 Hi, author of that RFC here. Although there seemed to be interest for it in the initial match() discussion, the stand-alone follow up was met with a giant "meh", which is why I didn't pursue it further. I would still be in favor of it, though, if it could get through internals. I'm happy to have someone pick it up and run with it, or collaborate on rebooting that RFC. (I'm pretty sure the patch for it actually worked, at least it did at the time.) --Larry Garfield

« previous php.internals (#126274) next »