Memory management and local GC?
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Sun Nov 1 10:40:48 UTC 2020
On Sunday, 1 November 2020 at 09:52:30 UTC, Kagamin wrote:
> The size and complexity of implementation of first class shared
> support in all types holds it from happening.
Shared should just be a simple type-wrapper that prevents access
to internals unless you use specific methods marked as
thread-safe for @safe code. Requiring atomic access to members do
not uphold the invariants of the object, so that is the wrong
solution.
If one add some kind of "accessible-shared" taint after the
caller has obtained read or write access then you can use the
type system to prevent disasters. One probably should have
"readable-unshared" and "writeable-unshared", to distinguish
between read-lock and write-lock protection. Then you map those
to say "scope parameters", so that unshared references cannot be
retained.
More information about the Digitalmars-d
mailing list