On Wednesday, 6 December 2017 at 18:09:45 UTC, Steven Schveighoffer wrote:
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

It also doesn't parse or do semantic checks on unit tests unless you add the flag...apparently.

This compiles...

unittest
{
    WHY DOESNT THE COMPILER FIND A PROBLEM HERE!?
}

It seems D's fast compile times are achieved by skipping semantic checking and even parsing when it doesn't feel it's needed. I strongly disagree with this decision. This could leave complex dormant time bombs that break builds unexpectedly and even accidentally. It's understandable in certain situations where there is enough information, but the first step to testing code, is first making sure it compiles...I don't want the compiler making decisions on what is worthy to compile. If I pass a d source file into it, I want to know if it's valid. This is unfortunate. This might be a deal breaker for me.
  • Does dmd not always compile ... A Guy With a Question via Digitalmars-d-learn
    • Re: Does dmd not always... Atila Neves via Digitalmars-d-learn
      • Re: Does dmd not al... A Guy With a Question via Digitalmars-d-learn
        • Re: Does dmd no... A Guy With a Question via Digitalmars-d-learn
          • Re: Does dm... A Guy With a Question via Digitalmars-d-learn
            • Re: Do... A Guy With a Question via Digitalmars-d-learn
              • Re... A Guy With a Question via Digitalmars-d-learn
                • ... Nick Treleaven via Digitalmars-d-learn
                • ... Steven Schveighoffer via Digitalmars-d-learn
                • ... Steven Schveighoffer via Digitalmars-d-learn
                • ... A Guy With a Question via Digitalmars-d-learn
                • ... A Guy With a Question via Digitalmars-d-learn
                • ... Atila Neves via Digitalmars-d-learn
                • ... Steven Schveighoffer via Digitalmars-d-learn
                • ... user1234 via Digitalmars-d-learn
            • Re: Do... Gary Willoughby via Digitalmars-d-learn
    • Re: Does dmd not always... Adam D. Ruppe via Digitalmars-d-learn

Reply via email to