Am 21.01.2011 21:31, schrieb spir:
On 01/21/2011 09:18 PM, Daniel Gibson wrote:
You're thinking of closures (which are also "delegates" in D), but D's
delegates can also be used to simple point to a member of an object.
It's kind of hidden in the definition:

"Delegates to non-static nested functions contain two pieces of data:
the pointer to the stack frame of the lexically enclosing function
(called the frame pointer) and the address of the function.
_This is analogous to struct/class non-static member function delegates
consisting of a this pointer and the address of the member function._
Both forms of delegates are interchangeable, and are actually the same
type: [...]"


Thank you for the information, Daniel. You are right: I didn't even know
"delegate" is used in the second sense. Then, what is he difference
between a delegate in the second sense and a (non-static) "member
function" (I mean a method)?
Or is "delegate" the name of the data structure (implementation side)
and "member function" or "method" the name of what it holds or means
(semantic side)?

Denis
_________________
vita es estrany
spir.wikidot.com


A delegate is like a function pointer to a method.
So like a function pointer is not a function a delegate is not a method ;)
See also Steves code example.

Cheers,
- Daniel

Reply via email to