template debuging
JS
js.mdnq at gmail.com
Thu Jul 18 04:16:25 PDT 2013
Anyone successful at debugging templates and ctfe?
Also, I am using pragma a lot because it seems to be the most
direct way to get ctfe state information.
I would like to be able to toggle when to show pragma so I can
conditionally enable it during compilation.
e.g., suppose I have a template T that I has pragma debug
messaging and I want to enable it only for a call to T:
___DEBUG___ = true;
T!()
___DEBUG___ = false;
(Not sure if this will produce the correct result depending on
how the compiler analyzes the code)
Right now I have to use an immutable bool for debug which is a
global toggle... I don't see any thing around it because I can't
change an immutable at compile time(or can I?)... which,
technically should be valid because an immutable is a declaration
about the state of a variable at run time, so I should be able to
change it at compile time without changing that fact.
e.g.,
immutable bool x = true;
x $= false; // $= means static assignment, a compile time
assignment.. not sure if x should be true or false for the whole
program at run time(probably true, site of definition).
Or
ctfe bool x = true; defines a ctfe variable at compile time. x
doesn't exist a run time.
More information about the Digitalmars-d-learn
mailing list