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.

--
/Jacob Carlborg

Reply via email to