1.0 ?? [templates and currying]

Kirk McDonald kirklin.mcdonald at gmail.com
Tue Nov 7 00:09:59 PST 2006


Walter Bright wrote:
> Kirk McDonald wrote:
>> Which brings up another point: It's really great that you added the 
>> .ptr property to delegates in 0.168, but it would also be great to 
>> have a .fn property to access the function pointer. (And optimally, 
>> this pointer would be of the right type, and not just a void*.)
> 
> 
> Ok, but as long as everyone realizes the function cannot be called via 
> that function pointer (because the calling convention for delegates is 
> different because there's that extra parameter). The type of the 
> .funcptr would only be useful for extracting other information.

The hope is that I could then say something like this:

class Foo {
     void func() { }
}

void main() {
     void delegate() dg;
     Foo f = new Foo;
     dg.ptr = &f;
     dg.funcptr = &Foo.func;
     dg();
}

-- 
Kirk McDonald
Pyd: Wrapping Python with D
http://pyd.dsource.org



More information about the Digitalmars-d mailing list