On 05/16/2017 02:57 PM, Jerry wrote:
My understanding is that we want to pass functions to functions which takes delegates transparently, or is it something more involved here?
That's about it. It's not a big thing. Would just be nice to have.
Anyway if that is everything, then why not add a template to the D runtime which casts the function to a delegate?
You can't currently cast a function (pointer) to a delegate. You have to create a wrapper delegate that calls the function. std.functional.toDelegate does this.
And if that wrapper function is only called by the compiler it does not even have to be a template. Templetation just provides type safety in this case.
Walter doesn't like the idea of doing toDelegate automatically. He says it has "negative performance implications that users could find very surprising" [1].
[1] https://issues.dlang.org/show_bug.cgi?id=17156
