D is our last hope

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Tue Dec 19 20:38:24 UTC 2023


On 20/12/2023 9:32 AM, Walter Bright wrote:
> On 12/5/2023 1:26 PM, GrimMaple wrote:
>> If you design a `@nogc` library, then GC people are left out.
> 
> GC code can call @nogc code, so I'm not sure how they are left out.

One reason would be callbacks.

I.e.

```d
void func(scope void function() @nogc del) @nogc {
	del();
}

void callback() {

}

func(&callback);
```

The easiest solution to make that work that I've come up with is to 
invalidate both ``@nogc`` attributes when the argument to func hasn't 
got it.


More information about the Digitalmars-d mailing list