switch()

Daniel Murphy yebbliesnospam at gmail.com
Tue Feb 18 09:26:36 PST 2014


"Steven Schveighoffer"  wrote in message 
news:op.xbhkirppeav7ka at stevens-macbook-pro.local...

> My point though, is that the change to require default gains you nothing 
> except annoyed programmers. Why put it in?

It only gains you nothing if you respond to the error by mindlessly putting 
a default: break; in.

The compiler is trying to help you by getting you to take an extra second 
and explicitly state what you what.  If you are automatically silencing the 
error without thinking about the semantics you want, you absolutely should 
be irritated, but the compiler is not the one doing something stupid here.

The awful part of checked exceptions comes from two place IMO - the ide 
gives you a very very easy way to do thing wrong thing (two clicks IIRC), 
and doing the right thing is often very very difficult (change exception 
lists on every calling functions).

Here the right and wrong choice are about equal difficulty - trivial.  I 
think complaints about typing those extra couple dozen keystrokes are on the 
same level as "why do I have to put these ';'s everywhere" and "'immutable' 
has too many letters". 



More information about the Digitalmars-d mailing list