Re:Visualising the .NET Garbage Collector
by Arnavion on Tuesday June 21, 2016 @02:24AM
(#11943851)
The .Net runtime already provides you the tools to implement RAII. The library exposes this functionality canonically with `IDisposable` [1] When you're done with your object, you call `obj.Dispose()` on it.
Your language could automatically derive `IDisposable` (or any similar interface) in the same way for every type, and insert calls to `this.Dispose()` based on scope.
Of course the .Net library itself requires GC. You can't change that.
Your language could automatically derive `IDisposable` (or any similar interface) in the same way for every type, and insert calls to `this.Dispose()` based on scope.
Of course the .Net library itself requires GC. You can't change that.
[1] https://msdn.microsoft.com/en-us/library/ms244737.aspx