There are three arguments why the N case is significantly different from the 2 

There are a number of idioms that require statements in addition to an 
expression.  Debugging printfs, objects that take statements to initialize 
(construct/set/set/break), incrementing counters, cases that require side 
conditions (if today is tuesday do one thing, otherwise another), etc.  Each 
individually is rare-ish, but not all that rare.  

The "static applicability" argument is that the larger the number of cases, the 
more likely one of them will fall into one these buckets, and then the  whole 
thing has to fall back to statements.  This makes expression switches less 
useful, and falling off this cliff is likely to irritate users every time it 

The “dynamic applicability” argument is that, if you want to change an existing 
switch (say, to add a debugging printf in one path), you have to refactor the 
whole thing.  Which will be met, by users, with “YGBFKM.”  

The “cliff height” argument says that falling off the cliff on a two-way 
conditional and having to refactor to if-else is far less painful than falling 
off the cliff on an N-way switch.  Its a more painful refactor.  

So for all these reasons, not being able to occasionally include some 
statements means many more switches that can’t use the feature (which is safer, 
clearer, and more compact), and also more often that the user will have to 
gratuitously refactor perfectly good code as they make small changes.

> On Mar 13, 2018, at 8:59 PM, Kevin Bourrillion <> wrote:
>  - Do nothing; only allow single expressions.  Non-starter.
> We're just saying the feature seems to be at least 90% as applicable without 
> it. Roughly. Why is it a non-starter for the other 10% to stick with the 
> switch they've always had? I'm sure there are good answers to that, I'm not 
> doubting there are, but I think we should explore them instead of just 
> declaring something a non-starter by fiat.
> Also, if it is true that this is a "non-starter", I would assume it is also a 
> non-starter to only allow single expressions in the conditional operator 
> `?:`. If not, what is the fundamental difference?

Reply via email to