jarrett.billingsley at gmail.com
Sat Oct 10 19:45:03 PDT 2009
On Sat, Oct 10, 2009 at 8:45 PM, Ellery Newcomer
<ellery-newcomer at utulsa.edu> wrote:
> This is probably a bad idea, but from my readings of the dmd source, I
> noticed some preprocessor defines that looked useful, along the lines of
> #define CASES case A:case B: (etc)
> I'd kinda like something similar in D, but a naive attempt with mixins
> doesn't work, e.g.
> immutable string cases = "case 1: case 2:"; //my d2fu sucks
> Any ideas (not including concatenating cases with body of case)?
A single string mixin must consist of an entire, fully-formed
statement, expression, or declaration (depending on where it's used).
Case labels do not, on their own, count as a statement.
In addition, there is a bug that prevents you from string-mixing-in
cases inside a switch. For some reason you have to mix in the entire
More information about the Digitalmars-d-learn