Tasks, actors and garbage collection
sighoya
sighoya at gmail.com
Wed Apr 28 22:33:59 UTC 2021
On Tuesday, 27 April 2021 at 14:59:22 UTC, russhy wrote:
> i am asking we should aim to be a memory agnostic language,
> where one can plugin a GC transparently and do what ever he
> wants, and at the same time transition to a full manually
> managed scheme with allocators transparently
The problem is that you solely consider manual or managed
resources on their own, but resources alias other resources and
other resources alias the considered resource, the connection is
the problem.
Not only does the GC manage memory for you at runtime, it also
does this in a way to guarantee memory safety, speaking
differently, the GC is some kind of runtime lifetime manager,
although not a deterministic lifetime manager.
Anyway, this is a feature Rust completely lacks.
There are ways to reformulate the solution to cyclic data
structures differently, but mostly with some additional memory or
performance hit.
And just to say, no one moans when Rust didn't allow deleting
resources when lifetimes say no, but the GC shouldn't say no?
Solving the problem in Rust is similar to solving the problem in
D, just choose another memory model for the specific problem.
Could libraries more engage in providing such solutions, I think
yes, but generalizing algorithms to offer you the most performant
and safe code is hard and leads probably to a state space
explosion.
Just look at the many ways you can create containers in Rust, you
have Owned, Rc, Pin, Cell, Pin<...<...>> and whatever.
More information about the Digitalmars-d
mailing list