Does dmd not always compile all of the source code?

Steven Schveighoffer schveiguy at yahoo.com
Wed Dec 6 18:09:45 UTC 2017


On 12/6/17 12:17 PM, Steven Schveighoffer wrote:

> So why wouldn't the compiler fail? Because it has no idea yet what you 
> mean by Nullable. It doesn't even know if Nullable will be available or 
> not. You could even import Nullable, but Nullable!T may be an error.

To give an example of why the compiler waits until instantiation:

class C(T) : T
{
    void foo() { doesthisexist(); }
}

class D { void doesthisexist(); }

auto x = new C!D; // OK
auto y = new C!Object: // fail

-Steve


More information about the Digitalmars-d-learn mailing list