Write file at compile time?
Inquie via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Apr 3 14:20:41 PDT 2017
On Monday, 3 April 2017 at 19:34:36 UTC, Adam D. Ruppe wrote:
> On Monday, 3 April 2017 at 19:25:35 UTC, Inquie wrote:
>> what if I don't care about security reasons? I'm only needing
>> it for developmental purposes.
> Why does it have to be at compile time then? Just run an
> ordinary runtime program as part of your develop process; run a
> helper file in your makefile before compiling it.
Because it the code doesn't compile one has to copy and paste the
pragma output to a d file and compile it to find the errors. It
is useful to help debug mixins. Since D is pretty sorry at giving
useful information for mixins it is easier to write the mixins
out to disk in a d file then input them back in to the program. A
simple static switch can alternate between the two. If we could
output at compile time then we could
2. flip switch
3. compile and get useful error messages
2. copy pragma to do
3. flip switch
4. compile and get useful error messages
the pragma copy is, by far, the slowest step here and the others
can be automated to basically happen in one step(although, I
guess with some work one could automate the copying of the pragma
too but it is not as robust).
Would be much easier to simply have the ability to write to disk
instead of the console.
More information about the Digitalmars-d-learn