To ensure that the division between GC and non-GC has meaning. The cycle
must be broken somewhere!

GC memory can point to non-GC. If non-GC could, in turn, point to GC,
then it would be possible to form a reference cycle with GC memory:
non-GC memory could wind up owning itself. Meaning: destruction order
would become non-deterministic.

I am not sure you need something that strong. For example, lets say you have a type B and a type C that can form a cycle with each other. If you also have A type A that just points to B, A can point to a cycle, but cannot be part of one.

I think. Possibly we the determination of non-GC-ness of mutable memory
(involving inspection of the transitive closure of its structure) could
be refined in such a way as to differentiate the two. But with the
current non-GC-ness definition ("no mutable boxes holding recursive
tags") it won't work. We'd need to ... I guess be able to prove that the
GC-memory subgraphs within a non-GC type do not permit formation of
cycles between themselves. A vector of cyclic lists is itself acyclic,
say; so long as they're not cyclic lists of vectors of cyclic lists :)

Yes, cases like that is what I had in mind.

Seems potentially harder to formalize. If you're really interested in
studying the problem though, don't let me stop you! A clearer or more
precise / useful rule than the existing one is plausible.

Having the stronger distinction makes it easier and more efficient to implement the GC, so I would propose not adding it unless needed.

Now, I misunderstood what the current definition is since I thought it was the one that allowed non-GC to point to GC and you added the restriction for some other reason :-)

What the current definition is effectively then is that a type is GC if it can reach a cycle, correct?

-Graydon

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

Reply via email to