Writing/Creating files at compile-time

via Digitalmars-d digitalmars-d at puremagic.com
Mon Aug 10 00:50:27 PDT 2015


On Monday, 10 August 2015 at 07:05:40 UTC, Iain Buclaw wrote:
> On 9 August 2015 at 11:07, JDemler via Digitalmars-d 
> <digitalmars-d at puremagic.com> wrote:
>> We can read files at compile-time:
>>
>>   enum file = import(fileName);
>>
>> But we cannot write to a file or create files at compile time.
>>
>
> So, something like:
>
> enum contents = someCTFEStringFunction();
> export(fileName, contents);

Ugh… please don't add more ugly features that has to be ripped 
out to bring the language to a sane state.

A compiler should be able to compile all programs on a read only 
filesystem. If the language requires a filesystem to compile then 
I consider the language broken and in need of redesign.



More information about the Digitalmars-d mailing list