Writing/Creating files at compile-time

Iain Buclaw via Digitalmars-d digitalmars-d at puremagic.com
Mon Aug 10 00:02:35 PDT 2015


On 10 August 2015 at 07:54, ChangLong via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> On Sunday, 9 August 2015 at 09:07:51 UTC, JDemler 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.
>>
>> Generating code at compile-time and mixing it in is fun but has a few
>> flaws.
>> It isn't debuggable, the generated code cannot be directly inspected (we
>> have to use pragma(msg, )) and it is not possible to manually tweak it.
>>
>> If we could generate source files (.d) at compile time and then import
>> them using mixins or something else, these problems can be dealt with.
>
>
> what will bing D more awesomeness is a ctfe execute.
>
> enum file = execute("shell scripts");

I don't think so...


More information about the Digitalmars-d mailing list