On Monday, 21 January 2013 at 19:23:19 UTC, Jacob Carlborg wrote:
On 2013-01-21 20:00, Nick Sabalausky wrote:
I don't know whether or not it can be done in D. But, if it
can be
done, it would definitely require awkward syntax. Probably
more awkward
than the preprocessor-based syntax of the C/C++ version. (Not
that I
want a preprocessor in D.)
Maybe you could do it by sticking the whole coroutine into a
string
literal that gets ripped apart and reassembled by a CTFE D
parser, but
that would just be so clumsy and error-prone, and frankly far
more
complex than should really be necessary, that I'd call it more
of a
kludge than a solution. And really, if I have to write D code
inside a
string literal to use it, that alone indicates that we're
looking down
the wrong path.
I know people don't like it but I have to say, this seems it
could be a job for AST macros.
I was thinking the same thing, but don't wanted to bug people.
Indeed, it is the perfect job for AST macro. I can concur now
that you mentioned it xD