D doesn't have weak references. So how can I make a associative array of objects without preventing their destruction?

Steven Schveighoffer schveiguy at gmail.com
Fri May 10 13:01:03 UTC 2024


On Friday, 10 May 2024 at 11:05:28 UTC, Dukc wrote:

>
> This also gets inferred as `pure` - meaning that if you use it 
> twice for the same `WeakRef`, the compiler may reuse the result 
> of the first dereference for the second call, without checking 
> whether the referred value has changed!

This would be weak pure since the reference is mutable. This 
cannot be memoized.

-Steve


More information about the Digitalmars-d-learn mailing list