On Thursday, 7 November 2013 at 09:09:13 UTC, Jacob Carlborg wrote:
4) static imports

static import std.stdio;

void main ()
{
std.stdio.writeln("foo"); // fully qualified name is required
}

2 + 3) combining selective and renamed imports

import io = std.stdio : println = writeln;

void main ()
{
    println("foo");
    io.writeln("bar");
}

6) aliases

import std.stdio;
alias println = writeln;

void main ()
{
    println("foo");
}

Yeah, also good additions! I do favor renamed imports over static ones in most code because fully qualified names tend to be rather long for anything other than Phobos. It is still extremely useful for code generation stuff though.

Reply via email to