Order of import statements
Order of Import Statements
As an aid to maintainability, discoverability and possible automation, it would be helpful to have a simple import ordering convention? Specifically:
- imports from std come first. Root-level comes first, followed by in alphabetical order for sub-levels
- an empty line comes next
- imports from third-party come next. Root-level comes first, followed by in alphabetical order for sub-levels
- an empty line comes next
- imports from other modules in "this" organisation/project/library come last. Root-level comes first, followed by in alphabetical order for sub-levels
An example:
import std.loader;
import std.utf;
import std.c.windows.windows;
import mango.blah;
import mango.stuff;
import mango.abc.otherstuff;
import mango.things.nicethings;
public import mylib.stuff
public import mylib.badthings.hmm;
public import mylib.goodstuff.garbage;