switch()

Walter Bright newshound2 at digitalmars.com
Mon Feb 17 00:43:39 PST 2014


On 2/16/2014 7:39 PM, Manu wrote:
> I think a really useful construct could be made out of switch, but it seems that
> it won't happen because it must support C code unchanged.

I tend to agree with Andrei on this - the proposals aren't fundamental or game 
changing, and are kinda just bouncing the rubble around (po-tay-to vs po-tah-to).

 > Isn't that the entire point of final switch?
 > Why introduce final switch to address that, then do this aswell?

Implicit in your questions is switches will only be used on enums, i.e. all the 
values a type can be are known to the compiler. This is only true for a smallish 
subset of types that are switched on.

final switch : for enums

default : for everything else


More information about the Digitalmars-d mailing list