Hi,

I was reading with interest the proposal on library-defined garbage
collection (by use of dedicated types), and I have a couple of questions.

My main worry, and thus question, is how to handle cross-scheme cycles ?
There does not seem to be anything preventing me to have a Rc<Object>
reference a Gc<Object> (and vice-versa), and I am wondering how garbage
collectors are supposed to cooperate to realize that those may be dead
cycles to collect.

As such, I am wondering if despite being neat (and highly tunable) users
might not be satisfied with a simpler scheme. It seems to me that lifetime
already provide natural GC boundaries (they at least provide an upper-bound
of the lifetime of the object) and thus that maybe it may be more natural
to attach a gc to a lifetime (or set of lifetimes) rather than to a
particular object ?

I was thinking of something like:

#pragma gc ReferenceCountingGC
fn somefunction(s: String) -> Int

Note that in the latter case Rust would retain the @ sigil to denote
garbage collected pointers but depending on where the object was allocated
the @ would not refer to the same garbage collector.

I have, obviously, no idea whether this would actually practical; and it
might not!

-- Matthieu
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to