How can we view source code that has been generated (say via "static foreach") ?

Tejas notrealemail at gmail.com
Thu Sep 16 03:26:46 UTC 2021


On Wednesday, 15 September 2021 at 19:59:43 UTC, james.p.leblanc 
wrote:
> Dear All,
>
> In attempting to learn and use code generation, it
> would be useful to be able to view the source code
> that gets generated.
>
> However, with various combinations of templates, UDAs, and
> mixins it has not been easy.
>
> Is there some standard way this is done?
>
> Optimal would be to print out the entire generated source
> code to allow inspection.
>
> Best Regards,
> James

Use the `mixin` compiler flag

`dmd -mixin=<whatever-name> file.d`

Beware, this will also include **all** the mixin code from 
standard library and runtime.

But it's manageable, reflecting on my experience.


More information about the Digitalmars-d-learn mailing list