Quote1) "Advanced" TMP, where the cartesian product of types is literally computed by meta-code. The example code for Method 1 is clearly the most elegant and concise. Currently this solution has the problem that computing cartesian products in TMP is very slow to compile even for moderately sized product, and even worse causes the compiler to blow up as the size grows. However, I believe that these compiler issues can be overcome by using the MPL package I mentioned below --- but this remains to be tested.I don't think MPL will help improve. You mention long compile time (bad for production environments) and lots of GB memory.And for MO/FO developers who wish to do what-if scenarios the solution will be too inflexible IMO.Quote(2) Run-time polymorphism. This is essentially BLOCK I in Cuchulainn's post below. It is easy to implement, but very inelegant, goes against the design goals and will cause performance degradation. (I'm assuming we agree that BLOCK II is not helpful for the problem at hand.)"Get it working, then get it right, then get it optimised".Quote(3) Hard-coding at the top level. I originally dismissed this solution, and it is unfeasible to write this code by hand in larger examples. However, perhaps the solution could be made feasible where the original source (which may or may not be entirely in C++) is compiled once to obtain intermediate source code which is then run through the C++ compiler. It seems inelegant to me, but perhaps this is a normal procedure for large projects... It's inelegant, but it works. I would say that's the feeling of many FO quants. We can always make it bootiful, later.QuoteI would be very interested to see an example in C#. I'm currently reading about reflection in C#. We use 1) Builder and interfaces 2) Reflectipn to actuallly generate (emit) code. For example, C# generics cannot handle +, * so I use both Reflection and dynamic keywodrd to generate what I need. It's in the forthcoming Germani/Duffy book.My hunch is DI in C# is the way to go.
Last edited by Cuchulainn
on October 21st, 2012, 10:00 pm, edited 1 time in total.