we can simplify further (while still having formatted looking code) with !q{} instead of !() :
// applies to next decl
@deps!q{import std.algorithm;}
void test1(){}
// applies to a set of decls
@deps!q{import std.stdio;}{
void test2(){}
void test3(){}
}
// applies to all following decls (':')
@deps!q{import std.array;}:
// can specify other dependencies beyond imports and have arbitrary complex logic:
@deps!q{
import std.range;
static int[100] data2;
version(linux){
enum data1=import("foo");//string import
pragma(lib, "curl");
}
}:
void test4(){}
// Can alias some dependencies:
alias deps1=deps!q{import std.algorithm;};
@deps1
void test4(){}