D Language Local imports


You can also import symbols in any scope, the import will only be looked up when the scope is needed (i.e. compiled) and the imported names will only be exposed in the imported scope. Most commonly the scope for local imports are functions, structs and classes.

void main()
    import std.stdio: writeln;
    writeln("Hello world");
// writeln isn't defined here