On Tue, Jul 28, 2009 at 12:01 PM, bearophile<[email protected]> wrote: > Bill Baxter: >> Switch is a monstrosity pretty much any way you look at it. Sh had the right >> idea there. Is "case" really necessary there? Some syntax should >> suffice I would thing. And "default" is probably the world's most >> useless keyword. Why not "else:" or "*:" instead of introducing a >> whole new keyword? > > Case of Pascal is better (2 keywords where "of" isn't that useful, begin-end > are optional if you want more than one instruction, Pascal isn't > case-sensitive): > > Case X of > 1: Begin > ... > End; > 2 .. 10: Begin > ... > End; > ... > Else Begin > ... > End; > End; {CASE} > > But D is backward compatible with C (unlike languages like Scala, that > eventually D will need to take a look at), so this is an academic topic.
Except that it's very much not backwards compatible with C syntax in constructs that are very frequent in C: typedef/alias, #define. Changing the keywords used in a switch would be a very mechanical transformation, like changing typedef to alias everywhere it appears in C code you're translating. --bb
