D 2.0 - dalegates to function

Philipp Spöth no at spam.no
Sat Mar 3 08:49:19 PST 2007


Just for my understanding:
If functionpointers could hold delegates would delegates become completly redundant?


> Lionello Lunesu wrote:
> > But how can a delegate ever get "thunked" to behave like a function? R 
> > delegate(X...) => R function(C,X...), with the C the context ?
> 
> Basically, a bit of code is generated at run-time (on the heap) that 
> calls the delegate with the correct context pointer. Then that code is 
> pointed to by the function pointer.
> The context pointer can be put into the code as an immediate value.




More information about the Digitalmars-d mailing list