dmd 1.046 and 2.031 releases
bearophile
bearophileHUGS at lycos.com
Mon Jul 6 12:21:09 PDT 2009
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
More information about the Digitalmars-d-announce
mailing list