On the D Blog--Symphony of Destruction: Structs, Classes, and the GC

James Blachly james.blachly at gmail.com
Tue Mar 23 01:03:01 UTC 2021


On 3/18/21 5:21 AM, Per Nordlöw wrote:
> On Thursday, 4 March 2021 at 13:54:48 UTC, Mike Parker wrote:
>> The blog:
>> https://dlang.org/blog/2021/03/04/symphony-of-destruction-structs-classes-and-the-gc-part-one/ 
>>
> 
> Btw, what is the motive behind D's GC not being able to correctly handle 
> GC allocations in  class destructors.
> 
> Is it by design or because of limitations in D's current GC implementation?
> 
> And how does this relate to exception-throwing destructors in other 
> managed languages such as C# and Go; are they forbidden or allowed and 
> safe thanks to a more resilient GC?

It is a frustrating rough edge, esp for non-experts; I cut myself when I 
tried to use a custom logging function (which of course GC allocates) in 
class destructors.


More information about the Digitalmars-d-announce mailing list