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

From: Date: Wed, 13 Aug 2014 12:27:25 +0000
Subject: Re: [RFC] Disallow multiple default blocks in a single switch statement
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-76477@lists.php.net to get a copy of this message
Ferenc Kovacs wrote (on 13/08/2014):
agree, and I thought about mentioning that, but I left that out, because I'm not proposing to remove that ability (and I see more use-cases for that as mentioned in my previous email) but stating that this patch would make an arbitrary distinction between the normal and the default cases.
I'm not sure I agree that it's arbitrary. Having a switch with two "default" clauses is like having an if with two "else" clauses; specifying two case labels which can be true at the same time is like having two "elseif" clauses chained together that can both be true at the same time. One is clearly an error; the other is just poorly written logic, and you can't make the parser outlaw every instance of poor logic. -- Rowan Collins [IMSoP]

« previous php.internals (#76477) next »