Re: [PHP-DEV] Empty subject in match and switch constructions

2025-02-05 Thread Morgan
On 2025-02-05 09:49, Larry Garfield wrote: > 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 syn

Re: [PHP-DEV] Empty subject in match and switch constructions

2025-02-04 Thread Kamil Tekiela
It sounds like a nice QOL improvement. I'm ok with preg_match not working and I would even say it would be wrong if it did work like that. It would also prevent people from accidentally forgetting to provide the matching subject in as it would generate UnhandledMatchError with non-bool types. I do

Re: [PHP-DEV] Empty subject in match and switch constructions

2025-02-04 Thread Larry Garfield
On Tue, Feb 4, 2025, at 1:43 AM, Dmitry Derepko wrote: > Hi, Larry! > >> On Feb 3, 2025, at 10:01 AM, Larry Garfield 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 wrote: >>> >>> https://wiki.php.net/rfc/sh

Re: [PHP-DEV] Empty subject in match and switch constructions

2025-02-04 Thread Marc Bennewitz
Hi Claude, On 04.02.25 11:10, Claude Pache wrote: Le 4 févr. 2025 à 10:34, Dmitry Derepko a écrit : Hi, Claude! On Feb 4, 2025, at 11:44 AM, Claude Pache wrote: Hi, One issue to resolve is how to interpret: ```php $x = match {   preg_match('/a/', 'a') => "will it be matched ..."  , d

Re: [PHP-DEV] Empty subject in match and switch constructions

2025-02-04 Thread Claude Pache
> Le 4 févr. 2025 à 10:34, Dmitry Derepko a écrit : > > Hi, Claude! > >> On Feb 4, 2025, at 11:44 AM, Claude Pache wrote: >> >> Hi, >> >> One issue to resolve is how to interpret: >> >> ```php >> $x = match { >> preg_match('/a/', 'a') => "will it be matched ..." >> , default => "... o

Re: [PHP-DEV] Empty subject in match and switch constructions

2025-02-04 Thread Dmitry Derepko
Hi, Claude! > On Feb 4, 2025, at 11:44 AM, Claude Pache wrote: > > Hi, > > One issue to resolve is how to interpret: > > ```php > $x = match { > preg_match('/a/', 'a') => "will it be matched ..." > , default => "... or not?" > }; > ``` > > —Claude I wouldn’t discuss it there because the

Re: [PHP-DEV] Empty subject in match and switch constructions

2025-02-04 Thread Claude Pache
> Le 4 févr. 2025 à 08:43, Dmitry Derepko a écrit : > > Hi, Larry! > >> On Feb 3, 2025, at 10:01 AM, Larry Garfield 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 wrote: >>> >>> https://wiki.php.net/rf

Re: [PHP-DEV] Empty subject in match and switch constructions

2025-02-03 Thread Dmitry Derepko
Hi, Larry! > On Feb 3, 2025, at 10:01 AM, Larry Garfield 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 wrote: >> >> https://wiki.php.net/rfc/short-match >> https://externals.io/message/112496 > > Hi, author o

Re: [PHP-DEV] Empty subject in match and switch constructions

2025-02-02 Thread Larry Garfield
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 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. >>

Re: [PHP-DEV] Empty subject in match and switch constructions

2025-02-02 Thread Ilija Tovilo
Hi Dmitrii On Sun, Feb 2, 2025 at 1:05 PM Dmitry Derepko 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 { … }