D import idiom
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
source
.gitignore
README.md
dub.sdl

README.md

localimport

D import idiom originally described by Daniel Nielsen, see this blog post. Later refined by Dgame, see here.

I basically moved this into a module and added some tests.

import localimport;

void main() {
    from.std.stdio.writeln("Hallo");
    auto _ = from.std.datetime.stopwatch.AutoStart.yes;
    std.stdio.writeln("Wow!");
    static assert(std.traits.isIntegral!byte);
    static assert(std.math.PI > 3.14);
    /*
    // this throws at compile time
    from.std.stdio.thisFunctionDoesNotExist("Hallo");
    from.std.stdio.thisFunctionDoesNotExist(42);
    */
}