Re:Ask HN: Rust or Swift for system programming?
by spullara on Monday July 04, 2016 @05:30PM
(#12033121)
It is basically implicit manual memory management. You make sure that your ownership is properly accounted for and it will then properly manage the memory they use. Unlike in GC languages, you pretty much have to understand everything about how your resources are managed, even in the API design phase.
Re:Ask HN: Rust or Swift for system programming?
by winstonewert on Monday July 04, 2016 @05:37PM
(#12033156)
Is reference counting not implicit manual memory management as well?
Re:Ask HN: Rust or Swift for system programming?
by pcwalton on Monday July 04, 2016 @09:12PM
(#12033862)
No! Reference counting is dynamic tracking of object lifetimes. If reference counting is implicit manual memory management, then so is tracing GC!
Re:Ask HN: Rust or Swift for system programming?
by winstonewert on Tuesday July 05, 2016 @11:31AM
(#12037095)
Manual means "a thing operated or done by hand rather than automatically or electronically, in particular." It is very strange to me that you've decided the manual means: non-dynamic tracking of object lifetimes.
Re:Ask HN: Rust or Swift for system programming?
by nenreme on Tuesday July 05, 2016 @04:45AM
(#12035142)
Garbage collector frees objects when there are no more references to them. It thus does automatic memory management.
Borrow checker on the other hand doesn't alter lifetimes of objects, instead it doesn't allow you to keep references to things that were destroyed. I.e. it doesn't manage memory.
Re:Ask HN: Rust or Swift for system programming?
by winstonewert on Tuesday July 05, 2016 @11:53AM
(#12037257)
Sure, but I was talking about Rust's ownership system which certainly does alter the lifetime of objects. Rust automatically frees objects when the owner scope ends.
Is it? As I understand it, memory is handled primarily by the ownership system, and sometimes by reference counting. That doesn't seem to be manual memory management to me.