www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Re: dmd 1.046 and 2.031 releases

Andrei Alexandrescu:
 I agree. Probably a good option would be to keep on requiring break, but
 also requiring the user to explicitly specify they want fallthrough in
 the rare case when they do want it. I'd love to use "continue" for that
 but it's already "occupied" by cases like while (...) switch (...).
 Requiring !break or ~break would work but is a bit too cute. Adding a
 new keyword or a whole new switch statement is too much aggravation. I
 guess we'll have to live with it...

In D there is also the "break label". Languages like C# and Scala have chosen to break compatibility with C here. On the other hand, if a safer switch is introduced in D, most times you may want to use the C-style switch is in code ported from C. As there are safeD modules, there can be C-like too modules, where switches work as in C. (This has the downside that locally the code doesn't give you much clue, and you have to go look at the top of the module to see if it's a cmodule or not.) Bye, bearophile
Jul 06 2009