Re: Diff between function and delegate

2016-06-29 Thread jmh530 via Digitalmars-d-learn
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 d

Re: Diff between function and delegate

2016-06-29 Thread Meta via Digitalmars-d-learn
On Monday, 27 June 2016 at 19:59:05 UTC, Mathias Lang wrote: - You use `scope myDG = (Params) { body... }` It looks like i is still moved to the heap but marking `test` with @nogc compiles successfully. Then when I run the code the assertion is triggered. What exactly is going on here? auto

Re: Diff between function and delegate

2016-06-27 Thread Mathias Lang via Digitalmars-d-learn
On Monday, 27 June 2016 at 19:34:06 UTC, "Smoke" Adams wrote: I have alias fnc = void function(Object); alias del = void delegate(); Does func avoid the GC? I am passing in this to Object so I don't technically need a delegate or a "context". I want to be sure that I'm actually gaining someth

Diff between function and delegate

2016-06-27 Thread Smoke Adams via Digitalmars-d-learn
I have alias fnc = void function(Object); alias del = void delegate(); Does func avoid the GC? I am passing in this to Object so I don't technically need a delegate or a "context". I want to be sure that I'm actually gaining something here by doing this. I read somewhere that delegates only