Compile time function execution...

Walter Bright newshound at digitalmars.com
Fri Feb 16 10:59:13 PST 2007


Russell Lewis wrote:
> 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.

That'll become possible once templates are extended to be able to take 
alias expressions as arguments.



More information about the Digitalmars-d mailing list