On 17 February 2014 02:04, Chris Cain <clc...@uncg.edu> wrote:

> I think the main reason why switches work this way (and cannot/should not
> be changed) is because of one of the main design goals of D:
>
> http://dlang.org/overview.html
>
> #7: Where D code looks the same as C code, have it either behave the same
> or issue an error.
>
> The proposed changes would violate this, making existing C code change
> meaning silently (wrt implicit "break;" in particular).
>

Okay, but that doesn't address the range cases...


TBH, though, I agree that this is somewhat of a speed bump in D. I really
> rarely find myself using switches because of the same issues you mention.
> Unfortunately, without adding new syntax (which is also problematic for
> many reasons), such a thing cannot be fixed unless this goal is ignored.
>

I agree, I rarely use switch statements for the same reason. Deliberately
gimping a very useful control statement because it's shit in another
language (it really is!), seems like an extremely lame design goal to me.
switch could be so much more useful with these changes. I suspect most
people would avoid it much of the time for these reasons.

Reply via email to