Re: [PHP-DEV] Pattern matching details questions

2025-02-04 Thread Rob Landers
On Tue, Feb 4, 2025, at 22:16, Larry Garfield wrote: > On Tue, Feb 4, 2025, at 1:14 PM, Marc Bennewitz wrote: > > On 04.02.25 08:51, Rob Landers wrote: > >> > >> > >> On Tue, Feb 4, 2025, at 05:31, Larry Garfield wrote: > >>> Hi folks. Ilija is still working on the implementation for the patte

Re: [PHP-DEV] Pattern matching details questions

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

Re: [PHP-DEV] Pattern matching details questions

2025-02-04 Thread Larry Garfield
On Tue, Feb 4, 2025, at 1:14 PM, Marc Bennewitz wrote: > On 04.02.25 08:51, Rob Landers wrote: >> >> >> On Tue, Feb 4, 2025, at 05:31, Larry Garfield wrote: >>> Hi folks. Ilija is still working on the implementation for the pattern >>> matching RFC, which we want to complete before proposing it

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] Pattern matching details questions

2025-02-04 Thread Marc Bennewitz
On 04.02.25 08:51, Rob Landers wrote: On Tue, Feb 4, 2025, at 05:31, Larry Garfield wrote: Hi folks.  Ilija is still working on the implementation for the pattern matching RFC, which we want to complete before proposing it officially in case we run into implementation challenges. Such as t

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] RFC: Marking return values as important (#[\NoDiscard])

2025-02-04 Thread Derick Rethans
On Wed, 29 Jan 2025, Tim Düsterhus wrote: > Hi > > Volker and I would like to start discussion on our RFC to allow "Marking > return values as important (#[\NoDiscard])". > > Please find the following resources for your reference: > > - RFC: https://wiki.php.net/rfc/marking_return_value_as_impo

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