Re: Adding explicit intent for SWITCH/CASE fall through?
| From: | A.L.E.C | Date: | Sat, 19 Oct 2019 07:05:59 +0000 |
| Subject: | Re: Adding explicit intent for SWITCH/CASE fall through? | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-107578@lists.php.net to get a copy of this message | ||
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 functionality was the same
> (this is me being a little tongue-in-cheek here):
>
> - proceed
> - carry_on
> - persevere
> - keep_going
> - go_ahead
> - advance
> - go_forward
> - keep_on
> - furthermore
Or "pass", but very good candidate for consistency should be "continue". Of
course that
would be a big BC break.
Imo, this would make more sense if fallthrough did something more, e.g. allowing
case X:
if (something) {
fallthrough;
}
something-else;
break;
case Y: ....
Going this way we could imagine that fallthrough N could allow skipping N following
cases and fallthrough default jumping to the default section. Then,
don't we need a
way to jump outside of the whole switch statement? Ah, there's goto already. So,
maybe
extend goto somehow?
I'm just throwing some ideas to consider, I don't pretend they are good. Adding a no-op
keyword does not make much sense to me. It might be not useful enough to justify a BC
break. You could call it "noop" as well.
--
Aleksander 'A.L.E.C' Machniak
Kolab Groupware Developer [http://kolab.org]
Roundcube Webmail Developer [http://roundcube.net]
----------------------------------------------------
PGP: 19359DC1 # Blog: https://kolabian.wordpress.com