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

Daniel Keep daniel.keep.lists at gmail.com
Thu Oct 4 21:09:33 PDT 2007



Christopher Wright wrote:
> 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.

I think 854 is something of a side-concern, really.  :3

Incidentally, I'd completely forgotten about that one...

	-- Daniel



More information about the Digitalmars-d mailing list