Is it possible to "cache" results of compile-time executions between compiles?

TheFlyingFiddle via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jan 24 04:39:37 PST 2017


On Tuesday, 24 January 2017 at 12:19:33 UTC, ketmar wrote:
> On Tuesday, 24 January 2017 at 12:14:05 UTC, TheFlyingFiddle 
> wrote:
>> unittest
>> {
>>    enum s = import("myfile");
>> }
>>
>> Is there something similar to this for outputting files at 
>> compile-time?
>
> no. this is by design, so it won't be fixed. sorry. you may use 
> build script that will create the code first, and you can dump 
> `pragma(msg, …);` to file, but that's all.

Yeah, I guess allowing the compiler to produce arbitrary files 
would be problematic from a security standpoint.

Thanks for the pragma idea! Wrapping the build in a script is a 
satisfactory solution for me.


More information about the Digitalmars-d-learn mailing list