nxt.reflection

Resuable primitives for compile-time reflection. Used to implement design-by-introspection.

Examples

compile-time reflect on all compiled modules

import nxt.path;
// See: https://dlang.org/spec/traits.html#getUnitTests
foreach (test; __traits(getUnitTests, nxt.path)) {
	foreach (attr; __traits(getAttributes, test)) {
		pragma(msg, __FILE__, "(", __LINE__, ",1): Debug: ", attr);
	}
	// TODO: Call test();
	// test();
	// dbg(msg, __FILE__, "(", __LINE__, ",1): Debug: ", ut);
}

run-time reflect on all compiled modules

foreach (const module_; ModuleInfo) {
	if (module_) {
		// import nxt.debugio;
		// dbg(module_.name);
	}
}

Meta