Feature Request: Change the delegate type to void[] data instead of void *ptr.

Christopher Wright dhasenan at gmail.com
Thu Oct 4 15:35:01 PDT 2007


Daniel Keep wrote:
> What about this?  Leave delegates as they are, but introduce a new
> closure class of types.  In effect, these would be:
> 
> struct closure(returnT, argT...)
> {
>     void* func;
>     void[] data;
> 
>     returnT delegate(argT) opImplicitCast()
>     {
>         returnT delegate(argT) result;
>         result.func = this.func;
>         result.ptr = this.data.ptr;
>         return result;
>     }
> 
>     typeof(*this) dup()
>     {
>         typeof(*this) result;
>         result.func = this.func;
>         result.data = this.data.dup;
>         return result;
>     }
> }

I like it. Now just fix bug 854 and you're all set.



More information about the Digitalmars-d mailing list