Reading IDX Files in D, an introduction to compile time programming
Ali Çehreli
acehreli at yahoo.com
Fri Aug 21 20:50:06 UTC 2020
On 8/21/20 1:33 PM, H. S. Teoh wrote:
> On Fri, Aug 21, 2020 at 01:18:30PM -0700, Ali Çehreli via
Digitalmars-d-announce wrote:
> Generally, I don't expect directory traversal to ever be
> allowed at compile-time, since it opens the door to a huge can o'
> security worms. :-P
I've heard that before. So, if directory traversal is only for import
expressions then it should be fine because importing two files cannot be
less safe than importing one file. So, we need to let the compiler know
that we will import, nothing fancy:
// Mapping from file name -> content
string[string] contents = static import("my/dir");
Note the clever :o) use of 'static' which means "directory" in this
case. :o) Now we have all contents as an AA, ready to be parsed,
mixed-in, etc. But I this is not important at all. Build step is just fine.
Ali
More information about the Digitalmars-d-announce
mailing list