On Wednesday, 14 July 2021 at 18:33:56 UTC, Tejas wrote:
For deterministic object destruction, there's the ```scope``` storage class:

```d
scope class_instance = new class();
scope(exit) class_instance.destroy

```

One or the other. The `scope(exit)` will still fire on scope exit in the case of `auto class_instance`, and the object will still be destructed on scope exit without any such `scope(exit)` in the case of `scope class_instance`.

Reply via email to