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

downs default_357-line at yahoo.de
Wed Oct 3 22:03:46 PDT 2007


This could be made backwards compatible by the introduction of a void
*ptr() { return data.ptr; }

If the delegate is of a method, data references the object's data.
If the delegate is an inline function or nested function, data
references *the stack space in all the superior functions that it uses*.


Disadvantages: Delegates take size_t.sizeof bytes more space in RAM.
Advantages: I'll let the following function speak for itself.
> R delegate(T) close(R, T...)(R delegate(T) dg)
> {
>   typeof(dg) res=dg;
>   res.data=res.data.dup; // eventually moves area of stack into RAM
>   return res;
> }

What do you think?
 --downs



More information about the Digitalmars-d mailing list