3 ms·
Since reference counting is automatic for the most part, the language tries to express the semantics of references itself - for instance, you can capture self w
by dwaite 4y ago
Since reference counting is automatic for the most part, the language tries to express the semantics of references itself - for instance, you can capture self weakly for a callback later, and have to check that you still have a valid capture before use.
After that, your issues then are typically reference cycles, which can really only be found by tooling at runtime or by certain linting tools (e.g. warn that the type definitions make reference cycles possible, even if your code isn't making cycles). There are tools such as Instruments included with Xcode to help detect cycles at runtime.