Safer casts

Koroskin Denis 2korden at gmail.com
Tue May 13 07:19:53 PDT 2008


On Tue, 13 May 2008 11:59:16 +0400, Yigal Chripun <yigal100 at gmail.com>  
wrote:
> foo _is_ a delegate.
> there is no difference: As I explained in a different post, a delegate
> is simply two pointers where the context pointer either points to the
> surrounding function for nested functions or to the this pointer for
> methods.

No, it is not. It's just a function, that takes additional  
pointer-to-environment passed as a first (hidden) parameter (just like  
`this` inside member functions).
Note that you can't call it outside of the scope (since there would be no  
context pointer) unless you make delegate out of it (taking its address).  
That way, scope pointer stored in a delegate as well. That's all.



More information about the Digitalmars-d mailing list