On 6/9/15 12:58 AM, Kagamin wrote:
On Monday, 8 June 2015 at 22:22:51 UTC, Andrei Alexandrescu wrote:
On 6/8/15 1:25 PM, ponce wrote:
C++'s constexpr looks broken because everything must be marked
constexpre, which defeats the purpose of having compile-time code
looking like runtime code. But I never had the pleasure to use it.

Yeah, it's sadly quite björked. Scott Meyers and I looked at the
feature and the logical conclusion for a guideline was "Speculatively
mark everything in sight as constexpr". That doesn't quite scale. --
Andrei

Same as with @safe @nogc @nothrow @pure.

No, these are attributes that change the function's type; constexpr does not. (Plus, in D the attributes may be applied in bulk with ":" or "{}").

If you don't have ctfeability
expressed in function's contract, you have no idea how you can modify
the function's implementation so that to not break other people's code.
Sorry for making c++ look cute again :)

I guess you could do a lot worse than using a unittest to make sure a function is CTFEable.


Andrei

Reply via email to