On Wednesday, 15 March 2017 at 03:43:20 UTC, Inquie wrote:
So, is it possible to debug string mixins?

I ran visual D and tried to step in to a function that was generated by a mixin and it brought an open file dialog box asking me to load the source code where the function was located... of course, it wasn't located anywhere except in the mixin string.


This leads to the idea, why can't the compiler simply output the mixin string to a file then the debugger can load that source file?

One of the most frustrating things about D is not having the ability to debug it's powerful meta programming in any reasonable way. (bad enough having to resort to using pragma(msg))

But we can't even debug the results of those meta programming in the case of string mixins because there is no way to step in to them... It seems all the machinery is there, but just a few extra steps are needed.

In dmd ~master. there is an undocumented switch called -vcg-ast.
It will produce a file with everything expanded.
(Only if the code compiles with no errors).
It produces a cg-file which may or may not contain a valid source representation of the actual code compiled.

Reply via email to