Compile time function execution...
Russell Lewis
webmaster at villagersonline.com
Fri Feb 16 08:14:39 PST 2007
Walter Bright wrote:
> Russell Lewis wrote:
>> But here's my question: How do we have a compile-time switch which
>> controls what to compile-time evaluate and what not?
>
> It's not necessary. The context completely determines what to
> compile-time and what to run-time.
Please don't misunderstand me. I understand how your design works.
(And I think it's a pretty good one.) But what I'm saying is that
somebody might want to write code like this:
int i;
version(debug)
i = eval!(MyFunc());
else
i = MyFunc();
Perhaps they want to do this because MyFunc() is still being debugged,
or because MyFunc() takes a while to do compile-time function execution.
How would one write a cleaner syntax for this? I'd like so see
something like:
int i = exec_compile_time_on_release_build!(MyFunc());
but I'm not sure how one would code it.
More information about the Digitalmars-d
mailing list