Help the old man learn D

Charles Hawkins via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jun 26 09:57:13 PDT 2015


On Friday, 26 June 2015 at 15:33:25 UTC, Charles Hawkins wrote:
> On Friday, 26 June 2015 at 14:52:51 UTC, Marc Schütz wrote:
>> On Friday, 26 June 2015 at 14:39:05 UTC, Charles Hawkins wrote:
>>>[...]
> I think I've answered my own question regarding the callbacks 
> as well.  I realized that the only reason I made those sections 
> of code classes in OCaml, even though there would only be one 
> instance of them, was so I could do forward referencing.  I'm 
> hoping that I'll get function pointers instead of delegate 
> pointers if I convert the class back to a module.

Sorry for talking to myself, but I'm hoping someone will help me 
out.  The above idea doesn't work.  It appears that only the main 
program file is going to have function pointers while modules and 
classes will have delegates.  So, does a library that uses 
callbacks need 2 callback register functions as well as parallel 
storage mechanisms, or is there a fairly simple way to make it 
polymorphic?  I was hoping a newbie would be able to use this 
library, but not many newbies are going to understand this.  I 
suppose I could tell them to call registerFunction and if they 
get a compiler error, then call registerDelegate?  Or am I 
missing something?



More information about the Digitalmars-d-learn mailing list