Well, you might be linking to an external function /and/ don't want the function to be visible at module scope:
void main() { extern(C) double func(); // linked from some C library.. double result = func(); } You don't have to worry too much about your first example, it might compile but it won't link: import std.math: sqrt; void main() { double sqrt(); double result = sqrt(); } Error 42: Symbol Undefined _D12externalTest4mainFZv4sqrtMFZd --- errorlevel 1