www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - rename file, execute os, etc at compile time

reply Johnson Jones <JJ Dynomite.com> writes:
is it possible to do? I would like to pre-configure some stuff at 
"pre-compilation"(in ctfe but before the rest of the program 
actually gets compiled).

I know it's not safe and all that but in my specific case it 
would help.  I'll probably use pre-build events, which is 
probably the best, but just curious about it in general... I've 
been wanting to write a ctfe virus in D for a while now! j/k.
Aug 06 2017
parent reply Nicholas Wilson <iamthewilsonator hotmail.com> writes:
On Sunday, 6 August 2017 at 19:56:06 UTC, Johnson Jones wrote:
 is it possible to do? I would like to pre-configure some stuff 
 at "pre-compilation"(in ctfe but before the rest of the program 
 actually gets compiled).

 I know it's not safe and all that but in my specific case it 
 would help.  I'll probably use pre-build events, which is 
 probably the best, but just curious about it in general... I've 
 been wanting to write a ctfe virus in D for a while now! j/k.
It is deliberately not possible. reproducible builds security ect. have a look at dubs preBuildCommand(?)
Aug 06 2017
parent reply Johnson Jones <JJ Dynomite.com> writes:
On Sunday, 6 August 2017 at 23:11:56 UTC, Nicholas Wilson wrote:
 On Sunday, 6 August 2017 at 19:56:06 UTC, Johnson Jones wrote:
 is it possible to do? I would like to pre-configure some stuff 
 at "pre-compilation"(in ctfe but before the rest of the 
 program actually gets compiled).

 I know it's not safe and all that but in my specific case it 
 would help.  I'll probably use pre-build events, which is 
 probably the best, but just curious about it in general... 
 I've been wanting to write a ctfe virus in D for a while now! 
 j/k.
It is deliberately not possible. reproducible builds security ect. have a look at dubs preBuildCommand(?)
So it is intensionally preventing me from doing something I should be able to do if I want without issue because it thinks I will harm myself? Why not a compiler switch that enables it? It's blocking something that might be an issue but is almost surely not and prevents the vast capabilities that it would otherwise be able to accomplish. I guess one can always patch the compiler... But Dmd does give an error about security, it usually says that the there are not source code available for compile time or something like that.
Aug 06 2017
next sibling parent reply lobo <swamplobo gmail.com> writes:
On Monday, 7 August 2017 at 00:07:26 UTC, Johnson Jones wrote:
 On Sunday, 6 August 2017 at 23:11:56 UTC, Nicholas Wilson wrote:
 On Sunday, 6 August 2017 at 19:56:06 UTC, Johnson Jones wrote:
 [...]
It is deliberately not possible. reproducible builds security ect. have a look at dubs preBuildCommand(?)
So it is intensionally preventing me from doing something I should be able to do if I want without issue because it thinks I will harm myself? Why not a compiler switch that enables it? It's blocking something that might be an issue but is almost surely not and prevents the vast capabilities that it would otherwise be able to accomplish. I guess one can always patch the compiler... But Dmd does give an error about security, it usually says that the there are not source code available for compile time or something like that.
How is this a blocking anything when you can do it already with nearly every build tool available. Invoke a script or prebuilt binary etc. as a target that does the munging for you at pre-compile time.
Aug 07 2017
parent Johnson Jones <JJ Dynomite.com> writes:
On Monday, 7 August 2017 at 12:39:31 UTC, lobo wrote:
 On Monday, 7 August 2017 at 00:07:26 UTC, Johnson Jones wrote:
 On Sunday, 6 August 2017 at 23:11:56 UTC, Nicholas Wilson 
 wrote:
 On Sunday, 6 August 2017 at 19:56:06 UTC, Johnson Jones wrote:
 [...]
It is deliberately not possible. reproducible builds security ect. have a look at dubs preBuildCommand(?)
So it is intensionally preventing me from doing something I should be able to do if I want without issue because it thinks I will harm myself? Why not a compiler switch that enables it? It's blocking something that might be an issue but is almost surely not and prevents the vast capabilities that it would otherwise be able to accomplish. I guess one can always patch the compiler... But Dmd does give an error about security, it usually says that the there are not source code available for compile time or something like that.
How is this a blocking anything when you can do it already with nearly every build tool available. Invoke a script or prebuilt binary etc. as a target that does the munging for you at pre-compile time.
Very easy, it's blocking me from setting up templates that automatically do what I need when I copy and paste code from one project to another... ya didn't think about that, did ya? Oh, I know... you have some way out! I should be able to shoot myself in the foot if I want... no one should be able to decide what is best for me except me. They don't like it when I decide what is best for them and so should abide by the law of reciprocity.
Aug 07 2017
prev sibling parent Stefan Koch <uplink.coder googlemail.com> writes:
On Monday, 7 August 2017 at 00:07:26 UTC, Johnson Jones wrote:
 On Sunday, 6 August 2017 at 23:11:56 UTC, Nicholas Wilson wrote:
 On Sunday, 6 August 2017 at 19:56:06 UTC, Johnson Jones wrote:
 [...]
It is deliberately not possible. reproducible builds security ect. have a look at dubs preBuildCommand(?)
So it is intensionally preventing me from doing something I should be able to do if I want without issue because it thinks I will harm myself?
It has more profound reasons, more so then security it's a reproducibility issue. Also it would complicate the ctfe system.
Aug 07 2017