On Sat, 05 Dec 2009 16:08:00 -0500, Nick Sabalausky <[email protected]> wrote:
I just noticed in D1 that the values for the cases in a switch must be
known
at compile-time (btw, the docs don't seem somewhat vague on that). Is
this
also true in D2? If so, I don't suppose we could get that changed before
the
book? It's a real PITA for dynamic code.
you mean a real PITA to use if instead of switch? AFAIK, switch is the
way it is to foster different optimizations by the compiler. I don't know
if optimizations can be performed if the cases are dynamic. Also, what
happens if two of the cases are dynamically the same? I think one of the
optimizations is that the compiler can reorder the cases to make the
testing more streamlined.
-Steve