Original Post
Hello! Recently I've been wondering; is it possible (within reasonable efford spans) to make code that writes code in C++? For instance; I could have a series of commands stored in a series of classes which point to eachother in a tree-branch way. 10 classes could draw a triangle, 10 others a square, all with unique variables etc. To call this, the software has to refer through all the classes, whilst essentially the thing being drawn could stay the same each frame. At first I thought of 'collapsing' the tree, and making every command in one list. Then I reasoned; why keep a list? Is it possible to let the program write a function that will call all the functions I stored? For instance, if a class calls the function "DrawTriangle(x, y)", x and y being class variables, it could write a command that calls DrawTriangle and 'bake' it's class x and y: if x = 10 and y = 20, it writes the command "DrawTriangle(10, 20);". I'd reserve a buffer capable of storing all the commands, fool my program into thinking it's a function, and BANG, it works or things go kabloo'ey :) This kind of cache'ing commands could be a speed gain, but I'm more interested in the technical side of it than in the practical side of it for now. So :) any thoughts?