Re: Read file on compiler time.

2014-05-29 Thread Remo via Digitalmars-d-learn
On Thursday, 29 May 2014 at 20:44:09 UTC, bearophile wrote: Remo: is it also possible to save/write string at compile time? There is pragma(msg, "...") but it's a little crappy. There are plans and a pull request for a good _ctWrite, but it's stalled for reasons unknown to me. Bye, bearop

Re: Read file on compiler time.

2014-05-29 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 29 May 2014 at 20:38:30 UTC, Remo wrote: Now another question is it also possible to save/write string at compile time? Sort of, use pragma(msg, "some string"); and it will be printed out when that code is compiled. Important that it is when the code is compiled, NOT when the co

Re: Read file on compiler time.

2014-05-29 Thread bearophile via Digitalmars-d-learn
Remo: is it also possible to save/write string at compile time? There is pragma(msg, "...") but it's a little crappy. There are plans and a pull request for a good _ctWrite, but it's stalled for reasons unknown to me. Bye, bearophile

Re: Read file on compiler time.

2014-05-29 Thread Remo via Digitalmars-d-learn
On Thursday, 29 May 2014 at 20:21:32 UTC, Adam D. Ruppe wrote: string a = import("file.txt"); dmd yourprogram.d -Jlocation_of_file so for example dmd yourprogram.d -J. if file.txt is in the same directory as the .d file. Excellent, thank you Adam! Now another question is it also possible

Re: Read file on compiler time.

2014-05-29 Thread Adam D. Ruppe via Digitalmars-d-learn
string a = import("file.txt"); dmd yourprogram.d -Jlocation_of_file so for example dmd yourprogram.d -J. if file.txt is in the same directory as the .d file.

Read file on compiler time.

2014-05-29 Thread Remo via Digitalmars-d-learn
Is there a way to read a text file into a sting at compile time in D2 ? It would be great to read for example some JSON file and then parse it using CTFU and create some D code based on it.