Source code output

H. S. Teoh hsteoh at quickfur.ath.cx
Tue Jul 16 22:27:49 PDT 2013


On Wed, Jul 17, 2013 at 05:27:34AM +0200, JS wrote:
> With heavy ctfe code generation usage is it possible to have the d
> compiler output the source code after all mixin templates have been
> "used"? This way it is easier to visually check for errors in the
> generated code.
> 
> I imagine one could use pragma in a "special way" to do this but I
> was hoping for something more direct.

Yeah I've been looking for this too. Once you have templates and mixins
nested deeply enough, it can be near impossible to figure out just
exactly *what* is being compiled at the end of it all.

Though I suppose the common approach is to generate a string
representing the code, and then using mixin(str) to compile it; this
lets you use pragma(msg) to output str and thereby see what exactly is
being compiled. But this may not be possible in some cases.


T

-- 
Be in denial for long enough, and one day you'll deny yourself of things you wish you hadn't.


More information about the Digitalmars-d-learn mailing list