On 07/06/2011 8:45 AM, Andreas Gal wrote:
So, I'm about ready to try an 'everything is garbage collected'
approach. There is a reason almost all recent languages have moved to
that...

Patrick and I were chatting about this yesterday. He feels that if we had 
unique pointers (which is really reference counting up to a maximum of 1 
reference), a lot of places would use them (maybe even most applications where 
we use reference counting right now). The rest a GC could handle. If this is 
really the case, giving up generalized ref counting doesn't sound too bad.

Ref counting is mostly orthogonal to the alias-analysis problem; there's a relationship to one of the two induction hypotheses to prove, but even then, only if you use a very conservative collector. Please don't conflate the two. "Just use GC everywhere" does not solve the second induction hypothesis (non-interference) so doesn't save us from having to dig into this: you can still mutate a multiply-referenced interior variant underfoot and cause someone to point into garbage memory.

IOW: please, everyone, stop saying "let's just use GC". It's no more an answer than "let's just do what C++ does" for scheduling. The problem is not actually solved by that answer. It's a partial and unsafe answer that paints us into a much harder to escape corner.

(This is not to say we're not having a GC. We've been committed to having a GC for the GC-allowed kinds of memory from ... at least a year and a half. And we may lean on it more or less heavily depending on the refcount costs we observe *once everything else is straightened out*. But again, mostly orthogonal to alias analysis.)

-Graydon

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to