3 ms·
I don't see the value TBH. constexpr is excellent for code readability. Even if the compiler could figure it out I'd vote to keep it. That said, if compiler cou
by omegalulw 5y ago
I don't see the value TBH. constexpr is excellent for code readability. Even if the compiler could figure it out I'd vote to keep it. That said, if compiler could figure it out than you can probably set up your editor to annotate it.
- WalterBright 5y agoAs the article points out, an entire function doesn't need to be CTFE compatible, only the particular path taken through the function by the interpreter. This makes constexpr more of an impediment than an enabler. Besides, people soon discover the utility of using functions at both compile and run time, and nobody has ever asked for D to require an annotation for it in 15 years.
- SubjectToChange 5y agoI don't see how constexpr is helpful for readability. As it stands, constexpr adds a significant amount of syntactic noise. D's approach is the correct one, IMO.
- pjmlp 5y agoCheck Circle for what would be possible in C++, if the compiler would do it for you. https://www.circle-lang.org/ https://www.circle-lang.org/