Re: Empty subject in match and switch constructions
| From: | Larry Garfield | Date: | Tue, 04 Feb 2025 20:49:55 +0000 |
| Subject: | Re: Empty subject in match and switch constructions | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-126286@lists.php.net to get a copy of this message | ||
On Tue, Feb 4, 2025, at 1:43 AM, Dmitry Derepko wrote:
> Hi, Larry!
>
>> On Feb 3, 2025, at 10:01 AM, Larry Garfield <larry@garfieldtech.com> wrote:
>>
>> 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:
>>>
>>> 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
>
> It looks funny that I’m following in your steps with the RFC’s didn’t
> go through 😃
>
> By the way, I’ve implemented empty match subject in a bit different
> way: https://github.com/php/php-src/pull/17692
I have no particular preference here; whichever approach Ilija thinks is better is what we should go
with. (Feel free to steal the AST printer parts from my PR if we end up going with your PR.)
> About the RFC. What’s the way to re-activate it?
> Will you re-activate it?
> Do I need to create a new one referencing to this one?
> Can you share rights to edit the RFC and we can push it further together?
Procedurally, since it was never voted on, I believe we can just move it back to "in
discussion" on the wiki, start a new official discussion thread, and go to town. I'm fine
with doing that if everyone else is. And of course add your name to it as well (and anyone else
that contributes).
The main question is whether there's enough interest to justify taking it to a vote. Would
anyone actually vote Yes for this? :-)
Feature-wise, I have to say I'd keep it strict-always, as both our PRs implement it. Yes, that
means preg_match() wouldn't be able to slot in transparently. I'm frankly OK with that;
hopefully pattern matching can be extended to a better regex syntax anyway in the future.
--Larry Garfield