On 8/20/2013 3:18 PM, Paulo Pinto wrote: > On Tuesday, 20 August 2013 at 16:07:00 UTC, Kagamin wrote: >> http://msdn.microsoft.com/en-us/library/system.type.makegenerictype.aspx >> How would you implement this in native code? > > Like we use to do in the old days when we were forced to rewrite > Assembly on the fly. > > Allocate a memory buffer with the required sizes and perform the > required set of initializations. > > This is no different than constructing C++ classes during runtime, > initializing the required helper structures like vtbl and calling > constructors. > > Nothing that cannot be done with either a set of helper functions on the > language runtime, or generating inline code. > > Yes, I am aware that this requires the ability to execute code from the > data segment. > > -- > Paulo
Isn't the approach you're describing *much* more error-prone than the example above?