Allocator-aware @safe reference counting is still not possible

Dukc ajieskola at gmail.com
Tue Jan 31 11:00:13 UTC 2023


On Monday, 30 January 2023 at 23:14:57 UTC, Timon Gehr wrote:
>
> Well, we have @system variables now, so we can have poor man's 
> typestate together with poor man's move semantics [1], like 
> already proposed by ntrel and Dukc.
>
> Why is this scheme not workable? Isn't this exactly the kind of 
> problem (non-trivial memory safety invariant) we invented 
> `@system` variables to solve?
>
> (With sumtype, I guess you can even move the flags to runtime 
> (at the cost of template bloat exponential in the number of 
> flags) to get poor man's dependent type state.)
>
> [1]: [snip]

Great, thanks for building this concept of proof! It indeed looks 
like the way to go for me if we agree that whitelists or 
certificates aren't thorough enough. I definitely want a solution 
that requires only minor or no language changes, and this might 
well be it.

Of course, we still have to look for weaknesses in this scheme. 
`SafeRefCounted` sure had it's share when it still was in the 
works, although I'm sure you're better than me foreseeing them.


More information about the Digitalmars-d mailing list