Diff between function and delegate
jmh530 via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jun 29 10:52:46 PDT 2016
On Monday, 27 June 2016 at 19:59:05 UTC, Mathias Lang wrote:
>
> Delegate don't GC allocate when:
> - You take a pointer to a member function
> - The function accept a `scope` delegate and you pass a literal
> - You use `scope myDG = (Params) { body... }`
I have a somewhat related question.
Why use a delegate for a closure if you can restructure the
function to use partial (from std.functional) instead? The
delegate will use GC, but I don't think partial would (but not
entirely sure).
More information about the Digitalmars-d-learn
mailing list