A template would be ideal. I looked at mixin templates and mixins too. But I could not see a way to do this.
The idea here was to create a base class which would have a function called register(). Register would take the function name (or function pointer), and create a delegate at compile time. register() would add the delegate and the function name as a string into the hash. At runtime, I pass in the string, get the delegate and invoke the function. So I need both the function name as a symbol (to create the delegate) and the function name as a string. In c/c++ I'd use the preprocessor to convert the symbol to a string via "#" (stringify). If D doesn't have the equivalent, the callers will have to do: register(bob, "bob"); granted not too terrible, but a pain nonetheless. John On Sat, Oct 22, 2011 at 8:45 PM, Robert Jacques <sandf...@jhu.edu> wrote: > On Sat, 22 Oct 2011 21:17:09 -0400, J Arrizza <cppge...@gmail.com> wrote: > > This would be easier with "stringify": >> register(bob, #bob); >> >> Anything like that in D? >> >> John >> > > What do you mean by "stringify"? Wouldn't register!bob be superior? >