Without contradictions the solution is trivial: module config; version(LogEnabled) enum isEnabled=true; else enum isEnabled=false; shared int level;