3 ms·
The idea of static meaning “fully evaluate this at compile time” in D is a good one.
by wbradley 5y ago
The idea of static meaning “fully evaluate this at compile time” in D is a good one.
- MauranKilom 5y agoObligatory C++ comparison: C++ has constexpr since C++11 and constinit since C++20. They mean more or less the same when applied to variables ("must be evaluated at compile-time"), but constinit does not imply constness.
- mhh__ 5y agoD evaluates until it hits something it can't manipulate at compile time whereas constexpr requires things to be annotated as such, so the difference is slightly more subtle.
- pjmlp 5y agoWhile true, Circle C++ compiler works as D does, although that is not standard, thus D does win in expressiveness.