skinny delegates

kinke noone at nowhere.com
Thu Aug 2 21:28:27 UTC 2018


Leaking may be an issue. This currently works:

```
static const(int)* global;

auto foo(const int param)
{
     return { global = ¶m; return param + 10; };
}

void main()
{
     {
         int arg = 42;
         auto dg = foo(42);
         auto r = dg();
         assert(r == 52);
     }
     assert(*global == 42);
}
```

`global` would be dangling as soon as the delegate `dg` goes out 
of scope.


More information about the Digitalmars-d mailing list