http://d.puremagic.com/issues/show_bug.cgi?id=6176



--- Comment #24 from bearophile_h...@eml.cc 2012-01-18 16:06:09 PST ---
(In reply to comment #23)

> This wouldn't make sense - why should I be forced to add something just to 
> show
> I know that all the case values are compile-time constants?

Let's assume in one case you want the compiler to produce a very efficient
switch, maybe because you are writing the main loop of a little interpreter. In
this case you don't want one of the cases to be on a runtime value _by your
mistake_, because this may break this compiler optimization, forcing a less
efficient compilation of the switch. So to be sure you are not doing such
mistakes, you add an annotation to the switch, and the compiler catches your
mistakes.

In the end I agree this is probably not necessary, and it's better for switch
cases to be required to always be compile-time constants, losing a bit of
switch flexibility.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to