https://issues.dlang.org/show_bug.cgi?id=17156

--- Comment #3 from Walter Bright <bugzi...@digitalmars.com> ---
(In reply to Eyal from comment #2)
> I see, but this would not be a problem if function was automatically
> convertible to delegate (std.functional : toDelegate).
> 
> Is there any reason that you cannot hand over functions when delegates are
> expected?

Yes. The ABI of how functions and delegates are passed ensures one cannot be
treated as the other.

The compiler could, behind the curtain, generate a wrapper to do this (as you
suggest), but that has negative performance implications that users could find
very surprising because it would be hidden from them. I prefer the library
template solution for that reason.

--

Reply via email to