Method pointers are *function* pointers?? Or delegates??

Daniel Murphy yebblies at nospamgmail.com
Fri May 18 19:37:44 PDT 2012


"Mehrdad" <wfunction at hotmail.com> wrote in message 
news:sxiwbwuwvcjrlvpfsgpi at forum.dlang.org...
> On Saturday, 19 May 2012 at 01:37:54 UTC, Daniel Murphy wrote:
>> No, that won't work in all cases due to the ordering of parameters, 
>> 'this' and the hidden struct pointer.
>
> Better than not working in /any/ cases lol. :P
>
> Maybe you can add a void* for the hidden struct parameter? idk...

I'd actually rather it /didn't/ work in any cases, and just returned void*. 
The .funcptr property of delegates too.  From what I can tell the main use 
of this 'feature' is to cause nasty bugs whenever somebody accidentally 
takes the address of a non-static member function without an instance.
Last time I checked, phobos uses this in a couple of places to see if a 
member function can be called with a specific set of args, but this can be 
replaced with S.init.func(...).  There is an existing bug report for this 
somewhere. 




More information about the Digitalmars-d mailing list