D's SwitchStatement accepts statements with ridiculous semantics

user1234 user1234 at 12.lo
Sat Sep 30 09:26:51 UTC 2017

On Friday, 29 September 2017 at 09:12:54 UTC, Don Clugston wrote:
> Or it may have just been an accident.
> But regardless of the original motivation, it allows some truly 
> dreadful semantics.
> Can we disallow this silliness please?

There are two big family of switches. C-like and Pascal like. In 
Pascal you can only have cases in the switch.

See https://en.wikipedia.org/wiki/Switch_statement#Semantics

The C form doesn't prevent you to be stricter but it's all about 
self-discipline since the compiler will allow everything in there.

More information about the Digitalmars-d mailing list