4 ms·
> Now std::*_ptr<> types don't count to make the language GC, because their use is not enforced by the compiler. Then you also shouldn't say that Swift is garb
by hellofunk 10y ago
> Now std::*_ptr<> types don't count to make the language GC, because their use is not enforced by the compiler.
Then you also shouldn't say that Swift is garbage collected.
- pjmlp 10y agoSwift RC is managed by the compiler and is visible in the type system and language semantics. C++ language definition doesn't give any special treatment tostd::*_ptr<> types regarding compiler semantics. They could be be something else.
- hellofunk 10y agoOnly partially, in Swift, it is still up to the user to cleverly work around scenarios that the system does not catch. Which is why you have weak references and other many tricks in the language to circumvent infinite reference cycles and related problems. It's hard to call language garbage collected when you have to deal with all that stuff yourself. Just look at the stuff you have to do sometimes in your closures to avoid them creating memories leaks.