If I remember it correctly, I could definitely write codes like this:
let a = 3
DispatchQueue.main.async { [var b = a] in b += 1 }
But lately, I found there is now a compiler error for such code. It says: "Expected 'weak', 'unowned', or no specifier in capture list"
Is it I got wrong with my memory, or this feature was dropped somewhen?
If it's the latter case, is there any reference or evolution documents about this?
I don’t know the answer to if this was ever allowed, but reading your code I would be very surprised for b to escape this closure’s scope and to be defined in the parent’s scope. Is that what you mean for it to do?
It was possible to use var in a function parameter list… perhaps it was accidentally possible in a capture list too? Or they may have been conflated in memory, since that feature was removed quite a while ago.