Comment

Comment by WalterBright

> A good way to think about constant expressions is that `constexpr` is a hint that lets the compiler know that the variable or function CAN be evaluated at compile time, but it is not required

In D, CTFE (Compile Time Function Evaluation) is guaranteed to run at compile time. CTFE happens whenever there's a constant-expression in the grammar, such as the initialization of an enum:

    enum A = func(3);
func(3) evaluates at compile time.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton