Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This sounds different from common refcounting semantics in other languages, is it really so in Swift?

Usually access increases the reference count (to avoid the object getting GC'd while you use it) and weak pointers are the exception where you are prepared for the object reference to suddenly become invalid.



> Usually access increases the reference count

Taking shared ownership increases the reference count, not access.


When you have a strong pointer, you already have a positive ref count. Only once the strong pointer is destructed, is the reference count decremented.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: