On 05/03/2017 01:05 PM, ANtlord wrote:
As far as I know a delegate depends on GC.

Closures depend on the GC. Not all delegates involve closures.

For example, you don't need the GC to make a delegate of a method:

----
struct S
{
    int x = 0;
    void m() @nogc { x = 1; }
}

void main() @nogc
{
    S s;
    void delegate() @nogc dg = &s.m;
    dg();
    assert(s.x == 1);
}
----

Reply via email to