How about a 100% CTFE?

deadalnix deadalnix at gmail.com
Mon Nov 7 05:25:55 PST 2011


This doesn't make any sens.

Function can modify the state of the program in a non repeatable way, 
thus compile time function execution isn't possible for thoses.

CTFE must be limited to functions with no side effect, or with side 
effect that are known and manageable.

Le 07/11/2011 14:13, Gor Gyolchanyan a écrit :
> After reading
>
>      http://prowiki.org/wiki4d/wiki.cgi?DMDSourceGuide
>      https://github.com/gor-f-gyolchanyan/dmd/blob/master/src/interpret.c
>
> I had a thought:
> Why not compile and run CTFE code in a separate executable, write it's
> output into a file, read that file and include it's contents into the
> object file being compiled?
> This would cover 100% of D in CTFE, including external function calls
> and classes;
> String mixins would simply repeat the process of compiling and running
> an extra temporary executable.
>
> This would open up immense opportunities for such things as
> library-based build systems and tons of unprecedented stuff, that I
> can't imagine ATM.



More information about the Digitalmars-d mailing list