Blog: GC

Jesse Phillips Jesse.K.Phillips+D at gmail.com
Tue Mar 9 20:09:21 UTC 2021


On Saturday, 6 March 2021 at 20:21:41 UTC, Rumbu wrote:
> 
> C# has IDisposable/using and Java has AutoCloseable as 
> mechanisms for deterministic destruction.

https://docs.microsoft.com/en-us/dotnet/standard/garbage-collection/implementing-dispose#dispose-and-disposebool

If that is what solved looks like, D fairs pretty good.

C# `using` is pretty nice, but it's implementation is still in 
every library that supports it and not part of the language.

```
scope(exit) obj.destroy();
```

This provides the same semantics as the using declaration.

https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-8.0/using

Yes, D is different, but we shouldn't pretend other language 
solutions actually solved it.


More information about the Digitalmars-d mailing list