Dynamic code generation

Rufus Smith via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jul 19 21:36:01 PDT 2016


Does D offer any solutions to generate code dynamically? I would 
like to order based on optimal strategies. This requires 
effectively hard coding the execution path.

A simple example,

if (x == true)
    foo();
else
    bar();

can be recoded to be foo() or bar() while x is fixed, in my case 
x is fixed for long periods and therefor the check is 
unnecessary. I also know when x changes in all cases. This is 
just a simple example, of course. I would not want to resort to 
assembly programming to accomplish this.



More information about the Digitalmars-d-learn mailing list