Similar to Swift, weak and unowned references are a must for any language with reference counting and no automatic cycle breaking.
Weak references must be defined as nullable. When an object is deallocated, all weak references to that object get set to null. They do not modify the reference count of the object they refer to.
Unowned references are like weak references, except they are not defined to be nullable. Unowned references assume that the reference is guaranteed to live as long or longer than the object that holds the unowned reference. If an object is deallocated while an unowned reference to it is still held, any usage of that unowned reference will result in an immediate unrecoverable runtime error.
Similar to Swift, weak and unowned references are a must for any language with reference counting and no automatic cycle breaking.
Weak references must be defined as nullable. When an object is deallocated, all weak references to that object get set to null. They do not modify the reference count of the object they refer to.
Unowned references are like weak references, except they are not defined to be nullable. Unowned references assume that the reference is guaranteed to live as long or longer than the object that holds the unowned reference. If an object is deallocated while an unowned reference to it is still held, any usage of that unowned reference will result in an immediate unrecoverable runtime error.