switch()

deadalnix deadalnix at gmail.com
Tue Feb 18 10:49:34 PST 2014


On Sunday, 16 February 2014 at 15:43:31 UTC, Manu wrote:
> 1.
> case fall-through is not supported;

goto case; automagically goes to the next case.

> 2.
> 'case 1, 3, 7, 8:' is awesome! ...but ranged cases have a 
> totally different
> syntax: 'case 1: .. case 3:'
>
> Why settle on that syntax? The inconsistency looks kinda silly 
> when they
> appear together in code.

When implementing this on SDC. The .. syntax seems appropriate to
me, the current one is clearly insane.

> 3.
> Why is 'default' necessary? If I'm not switching on an 
> enumerated type,
> then many values are meaningless. requiring an empty 'default: 
> break;' line
> at the end is annoying and noisy.

Sounds like an improvement over conventional switches to me.


More information about the Digitalmars-d mailing list