switch()

Steven Schveighoffer schveiguy at yahoo.com
Tue Feb 18 08:38:41 PST 2014


On Tue, 18 Feb 2014 11:11:36 -0500, Daniel Murphy  
<yebbliesnospam at gmail.com> wrote:

> "Steven Schveighoffer"  wrote in message  
> news:op.xbhfr5kreav7ka at stevens-macbook-pro.local...
>
>> > Of course, no compiler can make you write correct code. But if you're  
>> > going to write a default anyway, odds are you'll choose the right one.
>>
>> I think your anecdotal experience with exception specification in Java  
>> is at odds with this expectation.
>>
>> We all know programmers who are faced with seemingly annoyance hoops to  
>> jump through jump through them with the least possible effort.
>
> It's not really the same, because silencing checked exceptions results  
> in a solution that is worse than not having checked exceptions at all.   
> Here if the programmer takes the 'easy route' and sticks in a "default:  
> break;" they're just getting the old behavior back.

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

I see your point that the difference between ignored exceptions and  
pass-through exceptions is a lot different than breaking by default on a  
switch statement. But I wasn't trying to make that comparison, just using  
it as an example of what programmers do.

The comparison I AM making is that we are implementation a requirement  
that will not achieve the behavior goal it sets out to achieve.

-Steve


More information about the Digitalmars-d mailing list