Re: [RFC] Disallow multiple default blocks in a single switch statement
| From: | James | Date: | Wed, 13 Aug 2014 08:13:57 +0000 |
| Subject: | Re: [RFC] Disallow multiple default blocks in a single switch statement | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-76462@lists.php.net to get a copy of this message | ||
Just saw the RFC today so I hadn't been able to comment on it until now..
If we are getting rid of it wouldn't it be better to emit an E_DEPRECATED
per
https://github.com/imnotjames/php-src/compare/switch.default.multiple-deprecated
and then remove it in the next major release?
This has been known to at least one person for many years if 034.phpt is to
be believed. I could see
where people would use it - there are reasons to, even if they are poor in
choice to do so.
I entirely believe this behavior is weird and should be removed. However,
breaking backwards
compatibility in a minor release because the incomplete spec says so is
kind of odd. A BC break
is a BC break, which doesn't belong in a minor revision.
Regards,
James
On Wed, Aug 13, 2014 at 3:47 AM, Ferenc Kovacs <tyra3l@gmail.com> wrote:
> On Wed, Aug 6, 2014 at 6:38 AM, Sara Golemon <pollita@php.net> wrote:
>
> > https://wiki.php.net/rfc/switch.default.multiple
> >
> > 'Cause this code is silly (even if it had case blocks), but we allow it:
> >
> > switch ($expr) {
> > default:
> > notExecuted();
> > break;
> > default:
> > executed();
> > }
> >
> > --
> > PHP Internals - PHP Runtime Development Mailing List
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> Hi,
>
> sorry to jump in this late, but I'm not sure that it is a good idea to only
> reject the multiple default blocks but keep the ability to have the same
> case multiple times:
> http://3v4l.org/eZdPU
> in this regard I think the current status is more consistent as it would
> after merging this patch.
> and I also think that this isn't an important enough issue to warrant a BC
> break (albeit this is the better kind of BC: probably doesn't effect too
> many people, and they will be clearly notified about the error at compile
> time) so I voted no based on this two thing.
>
>
> --
> Ferenc Kovács
> @Tyr43l - http://tyrael.hu
>