51 ms·
It isn't, because in other languages with linear/affine types it isn't called as such. Nor is C++s unique_ptr. Or Cyclone, which has region types. Rust isn't
by Manishearth 10y ago
It isn't, because in other languages with linear/affine types it isn't called as such. Nor is C++s unique_ptr. Or Cyclone, which has region types.
Rust isn't exactly revolutionary in its core memory management ideas, these have been around for a while and have been inside other languages. Cyclone, for example, is basically Rust (memory management wise) but as a safe dialect of C and a different stance on mutation and other things. It is not considered a GCd language. Rust just puts all these ideas together nicely.
The compiler doesn't actually keep track of a reference count, btw. Refcounting and linear types/ownership/borrowing lead to very different programming styles. In Rust's model you actually have to think about ownership and design your program with this in mind that as much as possible you want to use single ownership.
Given that they have very different impacts on programming style, they are pretty different practically speaking. On the other hand in swift you deal with memory management much like in Java, though with a few more choices you can make. Go might be a more apt comparison as far as memory management, though swift is more fine grained than Go as well.