Re: [PHP-DEV] Adding explicit intent for SWITCH/CASE fall through?

2019-10-21 Thread Mike Schinkel
> On Oct 20, 2019, at 7:28 AM, Rowan Tommins wrote: > On 20/10/2019 01:39, Mike Schinkel wrote: >> Not yet having experience working on PHP's parser I do not know how it is >> configured nor what about the design of PHP requires keywords unable to be >> used as constants, class names, function

Re: [PHP-DEV] Adding explicit intent for SWITCH/CASE fall through?

2019-10-20 Thread Rowan Tommins
Hi Mike, On 20/10/2019 01:39, Mike Schinkel wrote: Not yet having experience working on PHP's parser I do not know how it is configured nor what about the design of PHP requires keywords unable to be used as constants, class names, function or method names. I know this is a tangent but that

Re: [PHP-DEV] Adding explicit intent for SWITCH/CASE fall through?

2019-10-20 Thread Mike Schinkel
> On Oct 20, 2019, at 3:01 AM, A.L.E.C wrote: >>> It might be not useful enough to justify a BC break. > > That was my intention, to find more value in a new feature to justify BC > break. Your point was well taken, which is why I am now suggesting we consider (one of) the following instead

Re: [PHP-DEV] Adding explicit intent for SWITCH/CASE fall through?

2019-10-20 Thread A.L.E.C
On 10/20/19 2:39 AM, Mike Schinkel wrote: >> case X: >> if (something) { >> fallthrough; >>} >> something-else; >> break; >> case Y: > > Interesting. > > What would you expect this to do? It is not intuitively obvious to me. Directly jump to the next

Re: [PHP-DEV] Adding explicit intent for SWITCH/CASE fall through?

2019-10-19 Thread Mike Schinkel
> On Oct 19, 2019, at 3:21 AM, Kris Craig wrote: > If we're going to do this, let's take the opportunity to make it even more > useful. Assuming this idea truly does have momentum, I hope we do not get so focused on the `perfect` that we postpone the `good` indefinitely. There is always next

Re: [PHP-DEV] Adding explicit intent for SWITCH/CASE fall through?

2019-10-19 Thread Mike Schinkel
> On Oct 19, 2019, at 3:05 AM, A.L.E.C wrote: > Imo, this would make more sense if fallthrough did something more, e.g. > allowing > > case X: > if (something) { > fallthrough; >} > something-else; > break; > case Y: Interesting. What would you

Re: [PHP-DEV] Adding explicit intent for SWITCH/CASE fall through?

2019-10-19 Thread Kris Craig
On Sat, Oct 19, 2019 at 12:06 AM A.L.E.C wrote: > On 10/18/19 8:57 PM, Mike Schinkel wrote: > > Imo, this would make more sense if fallthrough did something more, e.g. > allowing > > case X: > if (something) { > fallthrough; > } > something-else; >

Re: [PHP-DEV] Adding explicit intent for SWITCH/CASE fall through?

2019-10-19 Thread A.L.E.C
On 10/18/19 8:57 PM, Mike Schinkel wrote: >> Suggestion: `next;` instead? > > I am agnostic about which word is used, so I would open up for suggestions if > others think there is a better word than `fallthrough`. > > As far as I care, it could be any of the following[1] as long as the >

Re: [PHP-DEV] Adding explicit intent for SWITCH/CASE fall through?

2019-10-18 Thread Mike Schinkel
> On Oct 18, 2019, at 4:45 AM, Markus Fischer wrote: > > On 18.10.19 00:07, Mike Schinkel wrote: >>case 'educationtype': >> $update = false; >> fallthrough; > > I was about to suggest `continue`, alas we know that would clash :-) > > Suggestion: `next;` instead? I am agnostic

Re: [PHP-DEV] Adding explicit intent for SWITCH/CASE fall through?

2019-10-18 Thread Mike Schinkel
> On Oct 17, 2019, at 11:14 PM, Bishop Bettini wrote: > > +1. It's 100% opt-in. People can keep using implicit fall-through, their own > /* fallthrough */ comments, or the new token. There's virtually no overhead > in the compile phase and it doesn't mess with the jump table optimizations. >

Re: [PHP-DEV] Adding explicit intent for SWITCH/CASE fall through?

2019-10-18 Thread Rowan Tommins
Hi Bishop, I'm not the proposer, but would like to answer your questions anyway. On Fri, 18 Oct 2019 at 04:14, Bishop Bettini wrote: > Do you envision this token accepting an optional argument, as break does, > to fall-through multiple nesting levels? Eg: > > $x = $y = $z = 1; > switch ($x)

Re: [PHP-DEV] Adding explicit intent for SWITCH/CASE fall through?

2019-10-17 Thread Bishop Bettini
On Thu, Oct 17, 2019 at 4:54 PM Mike Schinkel wrote: > Before creating an RFC I wanted to get reactions to the idea of adding > FALLTHROUGH option to SWITCH/CASE for when the developer explicitly want > logic to fall through to the next case and does not want to use a BREAK. > > My simples

[PHP-DEV] Adding explicit intent for SWITCH/CASE fall through?

2019-10-17 Thread Mike Schinkel
Hi All, Before creating an RFC I wanted to get reactions to the idea of adding FALLTHROUGH option to SWITCH/CASE for when the developer explicitly want logic to fall through to the next case and does not want to use a BREAK. My simples motivation for this feature is that my IDE (PhpStorm)