Re: [PHP-DEV] [RFC][DISCUSSION] Match expression v2

This is only part of a thread. view whole thread
  110249
May 22, 2020 15:30 larry@garfieldtech.com ("Larry Garfield")
On Fri, May 22, 2020, at 6:08 AM, Ilija Tovilo wrote:
> Hi internals > > I'd like to announce the match expression v2 RFC: > https://wiki.php.net/rfc/match_expression_v2 > > The goal of the new draft is to be as simple and uncontroversial as > possible. It differs from v1 in the following ways: > > * Blocks were removed > * Secondary votes were removed > * optional semicolon > * omitting `(true)` > * Unimportant details were removed (e.g. examples for future scope) > > You can look at the diff here: > https://github.com/iluuu1994/match-expression-rfc/pull/8/files > > I will also leave the discussion period open for longer as that too > was one of the primary criticisms. > > As mentioned by Kalle: > > > Resurrecting rejected RFCs have a "cooldown" of 6 months: > > https://wiki.php.net/rfc/voting#resurrecting_rejected_proposals > > That is, unless: > > > The author(s) make substantial changes to the proposal. While it's > > impossible to put clear definitions on what constitutes 'substantial' > > changes, they should be material enough so that they'll significantly > > affect the outcome of another vote. > > Given that many people have said without blocks they'd vote yes I'd > say this is the case here. Let me know if you don't agree. > > Ilija
I'd say this is a textbook example of sufficiently "substantial." Thanks, Ilija! This looks a lot better. My one question is why you're not including the implicit "match (true)" in this version, when the secondary vote on the previous RFC was 80% in favor of it. (And I still think the argument is stronger if you include a comparison to ternary assignment, but that doesn't affect implementation.) --Larry Garfield
  110250
May 22, 2020 15:42 tovilo.ilija@gmail.com (Ilija Tovilo)
Hi Larry

> My one question is why you're not including the implicit "match (true)" > in this version, when the secondary vote on the previous RFC was > 80% in favor of it.
I received quite a bit of feedback that the RFC was too complex. I tried to make the RFC simpler by removing all non-essential parts. I'm ready to create a follow up RFC for this (although it would probably not make PHP 8.0).
> (And I still think the argument is stronger if you include a comparison > to ternary assignment, but that doesn't affect implementation.)
Makes sense, I will incorporate an example :) Ilija
  110264
May 22, 2020 23:32 larry@garfieldtech.com ("Larry Garfield")
On Fri, May 22, 2020, at 10:42 AM, Ilija Tovilo wrote:
> Hi Larry > > > My one question is why you're not including the implicit "match (true)" > > in this version, when the secondary vote on the previous RFC was > > 80% in favor of it. > > I received quite a bit of feedback that the RFC was too complex. I > tried to make the RFC simpler by removing all non-essential parts. I'm > ready to create a follow up RFC for this (although it would probably > not make PHP 8.0).
Hm. A logical argument, but given its overwhelming support before and that it's therefore almost certain to pass in the future, I don't see why it's a net win to have PHP 8.0 missing that bit. It seemed uncontroversial, and seems like a highly common use case. --Larry Garfield
  110292
May 28, 2020 15:57 tovilo.ilija@gmail.com (Ilija Tovilo)
Hi Larry

> > > My one question is why you're not including the implicit "match (true)" > > > in this version, when the secondary vote on the previous RFC was > > > 80% in favor of it. > > > > I received quite a bit of feedback that the RFC was too complex. I > > tried to make the RFC simpler by removing all non-essential parts. I'm > > ready to create a follow up RFC for this (although it would probably > > not make PHP 8.0). > > Hm. A logical argument, but given its overwhelming support before and that it's therefore almost certain to pass in the future, I don't see why it's a net win to have PHP 8.0 missing that bit. It seemed uncontroversial, and seems like a highly common use case.
80% were in favor of this feature but it's also worth noting that only 20 people have voted. To avoid risking another rejection and thus the RFC being delayed for a year I'd rather move the feature to a different RFC. Also, the feature being included in the first draft was a rash decision in the first place (completely my fault). There are multiple ways to deal with the value comparison (e.g. do type coercion like the switch or type-error on a non-boolean value) but they haven't been discussed at all. Ilija
  114935
June 17, 2021 18:49 dygear@gmail.com (Mark Tomlin)
Please excuse the year long bump, but I was hoping to draw some more
attention to the implicit "match (true)" case. I'm just a regular user of
PHP, nothing too fancy, just one of the many, many people around the world
who use PHP. When I first started using match statements, I thought it was
a natural thing that an implicit "match (true)" would just work. I do hope
that this makes it into PHP 8.1, as that seems like the most obvious next
step here and it would be nice for it to make it into the very next release.

That is all. Thank you very much to Ilija Tovilo for adding the match
keyword to the language, and the whole PHP dev team for making this
incredible language. PHP has given me a whole career, and I am deeply
grateful to you all.

On Fri, May 22, 2020 at 11:30 AM Larry Garfield <larry@garfieldtech.com>
wrote:

> On Fri, May 22, 2020, at 6:08 AM, Ilija Tovilo wrote: > > Hi internals > > > > I'd like to announce the match expression v2 RFC: > > https://wiki.php.net/rfc/match_expression_v2 > > > > The goal of the new draft is to be as simple and uncontroversial as > > possible. It differs from v1 in the following ways: > > > > * Blocks were removed > > * Secondary votes were removed > > * optional semicolon > > * omitting `(true)` > > * Unimportant details were removed (e.g. examples for future scope) > > > > You can look at the diff here: > > https://github.com/iluuu1994/match-expression-rfc/pull/8/files > > > > I will also leave the discussion period open for longer as that too > > was one of the primary criticisms. > > > > As mentioned by Kalle: > > > > > Resurrecting rejected RFCs have a "cooldown" of 6 months: > > > https://wiki.php.net/rfc/voting#resurrecting_rejected_proposals > > > > That is, unless: > > > > > The author(s) make substantial changes to the proposal. While it's > > > impossible to put clear definitions on what constitutes 'substantial' > > > changes, they should be material enough so that they'll significantly > > > affect the outcome of another vote. > > > > Given that many people have said without blocks they'd vote yes I'd > > say this is the case here. Let me know if you don't agree. > > > > Ilija > > I'd say this is a textbook example of sufficiently "substantial." > > Thanks, Ilija! This looks a lot better. > > My one question is why you're not including the implicit "match (true)" in > this version, when the secondary vote on the previous RFC was 80% in favor > of it. > > (And I still think the argument is stronger if you include a comparison to > ternary assignment, but that doesn't affect implementation.) > > --Larry Garfield > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >
-- Thank you for your time, Mark 'Dygear' Tomlin;
  114953
June 18, 2021 14:23 larry@garfieldtech.com ("Larry Garfield")
On Thu, Jun 17, 2021, at 1:49 PM, Mark Tomlin wrote:
> Please excuse the year long bump, but I was hoping to draw some more > attention to the implicit "match (true)" case. I'm just a regular user of > PHP, nothing too fancy, just one of the many, many people around the world > who use PHP. When I first started using match statements, I thought it was > a natural thing that an implicit "match (true)" would just work. I do hope > that this makes it into PHP 8.1, as that seems like the most obvious next > step here and it would be nice for it to make it into the very next release. > > That is all. Thank you very much to Ilija Tovilo for adding the match > keyword to the language, and the whole PHP dev team for making this > incredible language. PHP has given me a whole career, and I am deeply > grateful to you all.
I wrote a separate small RFC for implicit-true match statements (https://wiki.php.net/rfc/short-match). There didn't seem to be a great deal of interest, though (https://externals.io/message/112496). There's not much else to do with that RFC beyond bring it to a vote and let the chips fall where they may. If folks think that's worth doing I can do so. It's not going to be able to scope creep much beyond its current minimalism. --Larry Garfield
  114957
June 18, 2021 15:03 guilliam.xavier@gmail.com (Guilliam Xavier)
On Fri, Jun 18, 2021 at 4:24 PM Larry Garfield <larry@garfieldtech.com>
wrote:

> On Thu, Jun 17, 2021, at 1:49 PM, Mark Tomlin wrote: > > Please excuse the year long bump, but I was hoping to draw some more > > attention to the implicit "match (true)" case. I'm just a regular user of > > PHP, nothing too fancy, just one of the many, many people around the > world > > who use PHP. When I first started using match statements, I thought it > was > > a natural thing that an implicit "match (true)" would just work. I do > hope > > that this makes it into PHP 8.1, as that seems like the most obvious next > > step here and it would be nice for it to make it into the very next > release. > > > > That is all. Thank you very much to Ilija Tovilo for adding the match > > keyword to the language, and the whole PHP dev team for making this > > incredible language. PHP has given me a whole career, and I am deeply > > grateful to you all. > > I wrote a separate small RFC for implicit-true match statements ( > https://wiki.php.net/rfc/short-match). There didn't seem to be a great > deal of interest, though (https://externals.io/message/112496). > > There's not much else to do with that RFC beyond bring it to a vote and > let the chips fall where they may. If folks think that's worth doing I can > do so. It's not going to be able to scope creep much beyond its current > minimalism. >
Before going to vote, I think the RFC should be updated to at least mention the strict-VS-loose comparison choice (for things like `match { preg_match(/*...*/) => /*...*/ }`). Regards, -- Guilliam Xavier
  115145
June 25, 2021 23:44 dygear@gmail.com (Mark Tomlin)
I really think that the implicit `match (true) {` is an easily understood
behavior.

On Fri, Jun 18, 2021 at 11:04 AM Guilliam Xavier xavier@gmail.com>
wrote:

> On Fri, Jun 18, 2021 at 4:24 PM Larry Garfield <larry@garfieldtech.com> > wrote: > > > On Thu, Jun 17, 2021, at 1:49 PM, Mark Tomlin wrote: > > > Please excuse the year long bump, but I was hoping to draw some more > > > attention to the implicit "match (true)" case. I'm just a regular user > of > > > PHP, nothing too fancy, just one of the many, many people around the > > world > > > who use PHP. When I first started using match statements, I thought it > > was > > > a natural thing that an implicit "match (true)" would just work. I do > > hope > > > that this makes it into PHP 8.1, as that seems like the most obvious > next > > > step here and it would be nice for it to make it into the very next > > release. > > > > > > That is all. Thank you very much to Ilija Tovilo for adding the match > > > keyword to the language, and the whole PHP dev team for making this > > > incredible language. PHP has given me a whole career, and I am deeply > > > grateful to you all. > > > > I wrote a separate small RFC for implicit-true match statements ( > > https://wiki.php.net/rfc/short-match). There didn't seem to be a great > > deal of interest, though (https://externals.io/message/112496). > > > > There's not much else to do with that RFC beyond bring it to a vote and > > let the chips fall where they may. If folks think that's worth doing I > can > > do so. It's not going to be able to scope creep much beyond its current > > minimalism. > > > > Before going to vote, I think the RFC should be updated to at least mention > the strict-VS-loose comparison choice (for things like `match { > preg_match(/*...*/) => /*...*/ }`). > > Regards, > > -- > Guilliam Xavier >
-- Thank you for your time, Mark 'Dygear' Tomlin;