News for hackers. Stuff that matters.
Re:C++17 constexpr everything, or as much as the compiler can by WalterBright on Thursday December 28, 2017 @05:08PM (#16025370)
You can annotate D functions as 'pure', which would have that effect, but purity is used for other reasons.

Evaluating functions at compile time has another wrinkle in D - it is path dependent:

    int square(int x) {
        if (x < 100)
            return x * x;
        printf("oops\n");
        return 0;
    }
    const int x = square(3); // works
    const int y = square(100); // fails at compile time
I.e. the path taken through the function has to be pure, not every part of the function.

There are no comments on this comment yet.