DIP81: Writing files at compile time
JDemler via Digitalmars-d
digitalmars-d at puremagic.com
Fri Aug 14 02:20:56 PDT 2015
On Thursday, 13 August 2015 at 10:06:32 UTC, Ola Fosheim Grøstad
wrote:
> You need to be able to tell the compiler what files should be
> included in the output bundle.
While I basically agree that this would be a nice to have feature
I do not think it is necessary and it would not make up for the
added complexity inside the export syntax.
If a specific source file should not be written to the file
system one can still use mixins.
>
> Actually, I think the file-model is too simple. I think you
> need a more advanced key-value database so that you can update
> different fields in the same ".ini file" from different source
> files.
This would a huge amount of complexity to the feature and would
not work in general. One can add keys to .ini and maybe .config
files but not to a .sql or .css file.
Also a append or prepend feature would make it impossible for the
compiler to tell when a generated file is finished.
Based on this discussion I updated the DIP.
Included are now the idea of mixin and template expanding (in the
section alternatives) and Ola's solution to the basic problems
which I originally missed out on (in the section implementation
considerations).
All in all I have to admit that the original approach was not
designed well enough. It was simple but not functional. Alas,
this new approach brings with it a completly different
implementation complexity.
Nevertheless, the idea of writing files at compile time is still
worth discussing about.
More information about the Digitalmars-d
mailing list