final switch traps and improvements
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Mon Dec 24 08:42:59 PST 2012
On 12/24/12 11:10 AM, Adam D. Ruppe wrote:
> 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
Oh, that's great!
> 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.
Yah, sorry for getting out of touch with the state of the art.
Andrei
More information about the Digitalmars-d
mailing list