Tue, 13 Oct 2009 02:50:11 -0400, bearophile thusly wrote: > Andrei Alexandrescu Wrote: > >> Usually you're >> all for adding features (hey, you just brought up the switch again! >> isn't that ironic?) and cleaning up bad parts of the language, > > Sorry, I'm not a computer scientist, and surely I am not a language > designer (especially for a C++-class language), so you may see some > contradictions in what I sometimes say :-) > > I have brought up the switch again because I was nervous, after spending > some time to find a bug caused by the current design of the switch. > > There are classes of bugs that aren't easy to avoid, but I think with a > less bug-prone switch I may avoid bugs like the one I have removed from > my code. One of the most basic part of the Zen of D is to help > programmers to avoid bugs, where possible.
I thought the priorities were 1) efficient systems programming features 2) metaprogramming fun 3) easy to use (if you come from c/c++) 4) cool new high level features (DbC etc.) 5) other features that make writing bug-free code easier > I hate the idea of having 3 different switches in the language (that's > why I was not happy to see the static switch, because a better redesign > of the *second* switch was in order). But the current situation of > switch is not good for D yet. A pattern matching switch which always returns a value, detects unhandled cases, matches more than just ints, enums, and strings, does not support break and goto, and automatically casts, would be nice.