On 11 June 2013 02:43, Jacob Carlborg <[email protected]> wrote:

> On 2013-06-10 18:34, Manu wrote:
>
>> On 11 June 2013 02:26, Jacob Carlborg <[email protected] <mailto:[email protected]>>
>>
>> wrote:
>>
>>     On 2013-06-10 17:40, David Nadlinger wrote:
>>
>>         Let me try to summarize it in code:
>>
>>         ---
>>         class A { void foo(); }
>>         auto memberFun = (&A.foo).funcptr;
>>
>>         auto a = new A;
>>         memberFun(a);
>>         ---
>>
>>
>>     Why is this better than a delegate?
>>
>>
>> It's not 'better', it's different.
>>
>
> class A { void foo(); }
> auto memberFun = (&A.foo).funcptr;
>
> auto a = new A;
> void delegate () dg;
> dg.funcptr = memberFun;
> dg.ptr = cast(void*) a;
> dg();
>
> The details can be hidden in a function call. Sure, a delegate could be
> type safe but still don't see the point.


You can see how much work that is right? And it's still not typesafe.
It's totally a hack.

Reply via email to