Remix.run Logo
zem a day ago

compile time function evaluation is "nice" in the same way those features are, isn't it?

WalterBright 2 hours ago | parent [-]

What's interesting is that other languages have since adopted CTFE, but they missed the point and did it wrong. The usual mistake is to add a keyword necessary to trigger it. D triggers it when an expression appears where a "const-expression" appears in the grammar. I.e:

    int x = f(); // f() is run at run time
    enum y = f(); // f() is run at compile time