How to see result of a mixin? (equivalent of running C preprocessor)

Lutger lutger.blijdestijn at gmail.com
Fri Jul 24 13:23:22 PDT 2009


asd wrote:

> I'm trying to get D-ObjC bridge working and I'm getting weird errors
> triggered somewhere deeply in a mix of templates and mixins that's too
> hard for me to understand.
> 
> How can I analyze such problem in D? Is it possible to tell dmd to run
> only compile-time functions/templates and output that as a D source?

Not directly except with descent. It's worth it to try descent compile time 
debugger (and compile time view!), really awesome stuff. 

Other than that, you can use pragma(msg, ...) where you have several options 
for ... depending on what you want to debug and whether it's D1 or D2. 
.stringof property and typeof() are useful for this. Take a look at 
std.traits and for D2 at __traits. Generally the error messages with such 
code is not so friendly. 

String mixins can also just be printed with writeln / Stdout.







More information about the Digitalmars-d-learn mailing list