Re: [RFC] Disallow multiple default blocks in a single switch statement
| From: | Lester Caine | Date: | Wed, 06 Aug 2014 12:00:06 +0000 |
| Subject: | Re: [RFC] Disallow multiple default blocks in a single switch statement | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-76375@lists.php.net to get a copy of this message | ||
On 06/08/14 11:16, Rowan Collins wrote:
> According to the bug report, HHVM also accepts multiple default blocks,
> but uses the first rather than the last. It's probably not worth
> implementing specific code there to take the last default label just in
> order to adhere to a 5.6 spec, but is worth making it detect multiple
> labels to bring it in line with the proposed change.
>
> So either we declare the php.net implementation to be in violation of
> the spec (which isn't completely insane - the spec shouldn't mirror
> behaviour to the point of incorporating the entire bug list); or we
> document the php.net behaviour as "correct", but accept that nobody is
> going to implement that part of the spec as written, and fix it in the
> next release of both the implementation and the spec.
It is perhaps interesting that this problem has not turned up before? As
I indicated in another thread I was surprised to see 'default' as the
first item in an example. I'm sure I'm not alone in always putting it at
the end, and I quite often will have a previous block which does not
have a 'break' so that the default element is added to other actions on
some keys for that reason. How much of the core PHP is still 'normal
practice' rather than 'by design' :)
--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk