On Sun, 27 Mar 2011 17:50:00 +0300, bearophile <[email protected]>
wrote:
This first question is mostly for D.learn, but below I show a partially
related link too, so I put both of them here.
If you have library code, and the users of your library run one of your
functions at compile time, later if you change your function it may not
run at compile time any more. So isn't the quality of being able to run
at compile time part of the signature of the function?
---------------
GCC 4.6 implements the C++0x constexpr. I've found a note about
constexpr, that touches the topic of logic const too, purity,
memoization:
http://stackoverflow.com/questions/4748083/when-should-you-use-constexpr-capability-in-c0x/4750253#4750253
Bye,
bearophile
constexpr is a primitive utility comparing to D, and why it is designed
the way it is in C++ is IMO nothing but to maintain backwards
compatibility, not because it has anything over what we have here.
enum ctfe = fun();
If "fun" no longer ctfe'able compiler will output and error and that is
all we need.
Why would a library designer care if his code will be executed at compile
or runtime? No reason i can think of.