3 ms·
The performance thing is a valid point, but, if I were working on something with margins that tight, I’d probably use unowned, or strong, anyway. There are a s
by ChrisMarshallNY 4y ago
The performance thing is a valid point, but, if I were working on something with margins that tight, I’d probably use unowned, or strong, anyway.
There are a significant number of folks that would sneer at me for even using optionals, in the first place, because, in their world, we should not be using classes, at all. It’s always fun to encounter that.
And, like I said, it really only applies to escaped/closure arguments, or class/instance properties. Locals are almost always strong, and I always unwrap in a guard/if before accessing, anyway, even if it is a local optional (which could introduce performance issues in tight spaces).
Reference loops are a huge pain to debug. It takes a lot less time to find the cause of a crash or unexecuted code, than a loop.
An important companion to always using weak, is also using lots of guards and tested unwraps. Without those, always using weak is just a bad habit, and sweeping bugs under the rug.
People are always happy to judge my coding habits, such as insisting on heavily documenting my code, and they are not always wrong, but I’ve been at this for a while. I get a lot done, quite quickly, and at a very high Quality level. It’s hard to argue with results.
- saagarjha 4y agoI guess I just feel that the silent failures that come from things being weak generally outweigh the leaks that come from reference cycles