final switch traps and improvements

Adam D. Ruppe destructionator at gmail.com
Mon Dec 24 08:10:31 PST 2012


On Monday, 24 December 2012 at 16:01:31 UTC, Andrei Alexandrescu 
wrote:
> I'd say we eradicate the exception altogether. Again, it 
> reflects incompleteness in language's approach. Requiring 
> people to add a

Note btw:

void main() {
         int a = 10;
         switch(a) {
                 case 10:
         }
}

test7.d(3): Error: non-final switch statement without a default 
is deprecated


final switch lets you get away without a default because it is 
supposed to ensure you have a case in there for everything.

That final switch(b) {case false: } compiles at all is the bug.


More information about the Digitalmars-d mailing list