Re:Compile-Time Sort in D
by wbradley on Saturday February 12, 2022 @07:15PM
(#30317736)
The idea of static meaning “fully evaluate this at compile time” in D is a good one.
[ Parent
| on HN ]
Re:Compile-Time Sort in D
by MauranKilom on Saturday February 12, 2022 @08:05PM
(#30318046)
Obligatory 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.
D 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.