March 02, 2007 Re: D 2.0 - dalegates to function | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lionello Lunesu | Lionello Lunesu Wrote: > I've had much need for passing function-pointers as delegates, but never the other way around. For example use object's methods as win32 window procedures, or as callbacks in C-libraries. -- serg. |
March 03, 2007 Re: D 2.0 - dalegates to function | ||||
---|---|---|---|---|
| ||||
Posted in reply to Frits van Bommel | 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.
|
March 03, 2007 Re: D 2.0 - dalegates to function | ||||
---|---|---|---|---|
| ||||
Posted in reply to Philipp Spöth | Philipp Spöth wrote:
> Just for my understanding:
> If functionpointers could hold delegates would delegates become completly redundant?
They'd probably still be the most efficient method.
|
Copyright © 1999-2021 by the D Language Foundation