Re:Reference count, don't garbage collect
by fingerlocks on Friday July 29, 2022 @08:01PM
(#32283040)
What do you mean? Potential reference cycles are a compile time error in Swift. That’s the whole point of the @escaping annotation
[ Parent
| on HN ]
So this[0] wasn't current despite being edited half a year ago? I guess I'm guilty of the same mistake the post had: criticizing without understanding the state of the art on the other side (at least I didn't miss it by 20 years and on an entire subfield of Computer Science).
[0] https://stackoverflow.com/questions/32262172/how-can-identif...
No, the SO post is accurate—it’s trivially easy to create strong reference cycles in Swift and @escaping annotation is only of limited use in detecting strong reference cycles. Though Swift also broadly pushes towards the use of value types for which creating reference cycles of any kind is impossible since they’re values, not references!