Re: Re: [RFC] Match expression
| From: | Dan Ackroyd | Date: | Sat, 09 Sep 2017 12:18:04 +0000 |
| Subject: | Re: Re: [RFC] Match expression | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-100489@lists.php.net to get a copy of this message | ||
On 9 September 2017 at 12:21, <ilija.tovilo@me.com> wrote:
> Hi everybody!
>
> Has this idea been discussed before?
> ..
> Each case has an implicit
break
This part has come up before, as the default behaviour of fall through
is a nasty gotcha for when you forget to put break. I can't find the
conversation right now, but the discussion was around a 'select'
keyword. I think the conversation didn't proceed as it seemed like
adding a new keyword just to fix the fall-through behaviour was a bad
tradeoff.
This RFC idea adds more capabilities, so is a better trade-off, and
more likely to be worth doing in my opinion.
> One downside, since PHP doesn’t implicitly return the last statement
> as some languages do there’s no obvious way to do multi-statement cases.
People are still working on and hoping for short-closures. That RFC
and any potential one for this, should attempt to use the same syntax.
On 9 September 2017 at 13:11, Andreas Treichel <gmblar@gmail.com> wrote:
> Something like:
>
> *wall_of_hard_to_read_code*
Yeah, that's a pretty good example of why I'd be in favour of this RFC.
cheers
Dan
Ack