This is bug or not? (immutable class containing struct with dtor)

Tejas notrealemail at gmail.com
Fri Dec 17 18:34:02 UTC 2021


On Friday, 17 December 2021 at 18:19:34 UTC, Denis Feklushkin 
wrote:
> On Friday, 17 December 2021 at 18:01:03 UTC, Tejas wrote:
>
>> I think since `immutable` objects are kept in Read Only Storage
>
> Some of them can be stored in ROM in some cases, but actually 
> "immutable" keyword means "not mutable for whole its lifetime"

Well, it would be really weird if destructors successfully 
executed for some class of `immutable` qualified objects but 
didn't for others.

Not too much of a stretch to imagine that destruction for 
immutable objects was outright disallowed.

Someone who can explain this behaviour more thoroughly would be 
much appreciated 😊

Maybe we should allow finalizers to mutate their instance?


More information about the Digitalmars-d-learn mailing list