Final by default?

Rikki Cattermole alphaglosined at gmail.com
Fri Mar 14 03:30:45 PDT 2014


Another option is using pure functions and static if's.

const bool ProgrammingSections = getProgrammingSections;
const bool PasteBinFullSection = getPasteBinFullSection;

pure bool getProgrammingSections() {
	if (CompleteSite) {
		return true;
	} else {
		return false;
	}
}

pure bool getPasteBinFullSection() {
	if (CompleteSite || ProgrammingSections) {
		return true;
	} else {
		return false;
	}
}

static if (ProgrammingSections) {
     // yay programming
}


static if (PasteBinFullSection) {
     // Ooo pastebin!
}


Also works rather well through different modules.


More information about the Digitalmars-d mailing list