Why is this variable first set to null then the new value

i agree with your guess, that pattern was a ritual from the Swift 5.4 days and you still see it in a lot of code bases today. in theory the consume/consuming keywords are supposed to replace this, but there are some bugs to be ironed out with those, so the ritual lives on.

these threads also discusses a similar topic: Appending to an Array stored in an enum case payload: O(1) or O(n)? - #3 by lukasa

1 Like