On Thursday, 18 July 2013 at 11:51:57 UTC, bearophile wrote:
JS:

Right now I have to use an immutable bool for debug which is a global toggle...

Aren't debug and version = id or version = number enough?

Bye,
bearophile

No, unless I litter the code with them(if I get what your saying). I don't want to whole program pragma output, just local pragma output.

I use static if (_MyLibrary_DEBUG) pragma(msg, txt) in my templates for debug output.

But I can only set _MyLibrary_DEBUG but not toggle it in code.

e.g.,

immutable _MyLibrary_DEBUG = false;

template T(string x) { enum T = x; static if (_MyLibrary_DEBUG) pragma(msg, T); }

T!("A");
_MyLibrary_DEBUG = true;
T!("B");
_myLibrary_DEBUG = false;
T!("C");



Only the pragma output of T!("B") should output.

Reply via email to