4 ms·
Strange, this bullet point appears in the summary but doesn't appear anywhere else in the article: Avoid assigning the result of an expression with side-effe
by cellularmitosis 11y ago
Strange, this bullet point appears in the summary but doesn't appear anywhere else in the article:
Avoid assigning the result of an expression with side-effects to left-hand-side with optional chaining
- gilgoomesh 11y agoYup, looks like an editing accident. In any case, you can probably guess what it was about. Something along the lines of: var z = nil let x = y?.getResult(&z) will z be changed?
- cballard 11y agoIMO, the anti-pattern in use here is out parameters, Swift has tuples for a reason!
- senderpath 11y agoSorry; editing mishap, yes. Here's the missing example: class Holder { var x = 0 } var n = 1 var h: Holder? = ... h?.x = n++ n // 1 or 2?
- senderpath 11y agoPS: We have corrected the editing glitch and restored the missing section. Thanks for catching it.
- triceam 11y agoYup, that was accidentally cut out when posting from the original writing. We've added it back in. Thanks for pointing it out!