Prevent struct going into heap memory
Paul Backus
snarwin at gmail.com
Mon Jul 21 02:03:54 UTC 2025
On Monday, 21 July 2025 at 00:31:10 UTC, Richard (Rikki) Andrew
Cattermole wrote:
>
> Ah see, I am arguing that the GC should handle cleanup.
Having read further, it looks like the problem is that the GC
currently does not have access to the necessary information to
call a closure's destructors at runtime (because D's closures are
type-erased). It seems like it ought to be possible to add this
information to the closure's context, though, at least in
principle.
> Problem is, some people believe it shouldn't. Hence this
> proposal to give those that want that "reliability" control to
> make it so.
If there are people who believe that (a) the struct instance
should be allocated with the GC, but (b) the GC should not be
responsible for its cleanup, then those people are wrong, plain
and simple.
On the other hand, if people want to assume control over both the
allocation and the cleanup, that's already possible with existing
language features.
More information about the dip.ideas
mailing list