Jarrett Billingsley wrote: > Well repeat should probably always take a delegate since most likely, > you're going to be passing it a lambda. However I agree that it would > be very, very nice to be able to make APIs take just delegates and > allow functions to be implicitly cast to them. You can already make > your own thunks, but they're not going to be as efficient as something > that actually works on an ABI level.
The problem is that function pointers and delegates have different calling conventions. You *might* be able to rig up an asm stub that compensated for the difference... not sure. As it stands, you can just use a function to create the delegate stub for you; doesn't even require a heap allocation! http://gist.github.com/140507
