Re: [RFC] Disallow multiple default blocks in a single switch statement

From: Date: Wed, 13 Aug 2014 13:19:10 +0000
Subject: Re: [RFC] Disallow multiple default blocks in a single switch statement
References: 1 2 3 4 5 6 7 8  Groups: php.internals 
Request: Send a blank email to internals+get-76483@lists.php.net to get a copy of this message
On Wed, Aug 13, 2014 at 2:58 PM, Rowan Collins <rowan.collins@gmail.com> wrote: > Ferenc Kovacs wrote (on 13/08/2014): > >> Btw. I've added a comment to >> https://bugs.php.net/bug.php?id=67757 as >> I've found some really weird behavior for multiple defaults and I think >> that it would be better to try to figure out and fix why do we pick the >> last default in the problematic snippet instead of trying to remove the >> multiple default support to get rid of the setup which can make this bug to >> surface. >> > > You're misinterpreting the behaviour of > http://3v4l.org/r3poR > > It is not selecting the first default, it just never needs to look for a > default, because it has already found a matching case label. > yes, and it continues the execution from the first matching case and correctly evaluates the following defaults, as default matches everything, which imo should be the correct behavior. > > If you supply a value which requires the default label to be selected, the > last default label will be selected, as in all other examples to date: > http://3v4l.org/lQ7WE > having a different behavior for default when there is a preceeding matching empty case is not the expected(from the userland point of view) behavior imo. ps: sorry for the imprecise/lousy definitions on my part, I hope I can get my message through though. -- Ferenc Kovács @Tyr43l - http://tyrael.hu

« previous php.internals (#76483) next »