On Wednesday, 12 November 2014 at 04:59:33 UTC, Shachar Shemesh
wrote:
On 10/11/14 16:19, Steven Schveighoffer wrote:
Only classes call dtors from the GC. Structs do not. There are
many
hairy issues with structs calling dtors from GC. Most struct
dtors
expect to be called synchronously, and are not expecting to
deal with
multithreading issues.
Note that structs inside classes WILL call dtors.
How is this any different? If one should not be allowed, how is
the other okay?
Supposedly, a struct destructor will only access resources that
the struct itself manages. As long as that's the case, it will be
safe. In practice, there's still a lot that can go wrong.