3 ms·
Oh, my bad! I didn't know I needed to talk to the OS to make a linked list.
by SamReidHughes 11y ago
Oh, my bad! I didn't know I needed to talk to the OS to make a linked list.
- kibwen 11y agoYeah, you do: https://github.com/python/cpython/blob/master/Objects/listobject.c https://github.com/python/cpython/blob/master/Objects/listob... You don't need unsafe code to make any data structure in Rust. Cycles can be made just fine using std::rc::Rc. The fact that it uses `unsafe` blocks under the hood doesn't mean it's not memory-safe. You seem to be vastly misinformed about what memory safety means.
- Jweb_Guru 11y agoRc is garbage collection, so it doesn't qualify for "any data structures you want without unsafe blocks or garbage collection (or no deallocation)." You can make cycles without Rc, of course.
- kibwen 11y agoRC without cycle collection isn't garbage collection by any definition that I'm aware of. :)
- Jweb_Guru 11y agoIt certainly is. http://researcher.watson.ibm.com/researcher/files/us-bacon/Bacon04Unified.pdf http://researcher.watson.ibm.com/researcher/files/us-bacon/B... Here is a post by pcwalton on the same subject: https://news.ycombinator.com/item?id=9095314 https://news.ycombinator.com/item?id=9095314.
- kibwen 11y agoIndeed, I have disagreed with pcwalton in the past over the inclusion of non-cycle-collected reference counting as garbage collection, because I feel that it unnecessarily muddies the waters in a world where "garbage collection" is so often understood to be merely a shorthand for "tracing garbage collection". And intuitively to me anyway, the phrase "garbage collector" implies something that is doing the collecting! In any case, the phrase has been too thoroughly co-opted. I prefer that we think up a new term to account for non-collected reference counting, such as "dynamic lifetime management". Propose your own term, I'm not picky. :)