defGlobalVariables

大域変数を宣言定義初期化します。

mixin template defGlobalVariables (
A...
) if (
A.length >= 2 &&
is(typeof(A[$ - 1]()))
) {
enum fn;
}

Examples

1 module foo;
2 
3 import std.stdio;
4 import graphite.utils.logger;
5 import carbon.templates;
6 
7 mixin defGlobalVariables!("logger", "logFile",
8 {
9     auto file = File("foo.txt", "w");
10     return tuple(.logger!(LogFormat.readable)(file), file);
11 });

Meta