Mixins and compile-time coding
janderson
askme at me.com
Tue Feb 6 20:23:06 PST 2007
Walter Bright wrote:
> janderson wrote:
>> Here's a suggestion that I actually sent a couple of of years ago that
>> actually make sense now with the new mixin stuff. What if you could
>> plugin dlls into DMD that would be run at compile time. The
>> requirement of use would be that the input parameters would be constant.
>
> The main problem with this is the malware author who puts some source
> code up, and when you try to compile it, it would install a rootkit.
Good point. What about the static version. ie
//This would be compiled on the fly. It could be put into its own object
file so it doesn't need to be re-built everytime.
mixin char[] stateMachine(char[] input)
{
...
}
void main()
{
stateMachine("ect...");
}
or
plugin char[] stateMachine(char[] input)
{
...
}
void main()
{
mixin(stateMachine("ect..."));
}
or
char[] stateMachine(char[] input)
{
...
}
void main()
{
mixin(plugin stateMachine("ect..."));
}
Something like that.
I guess malware may still be possible, but you can do that with unit
tests now. Essentially these are not much more then unit tests.
-Joel
More information about the Digitalmars-d
mailing list