4 ms·
While 4 touches on this a bit, I think another reason is that mutable value types are generally harmful. Save mutability for compiler optimizations and write yo
by cballard 11y ago
While 4 touches on this a bit, I think another reason is that mutable value types are generally harmful. Save mutability for compiler optimizations and write your code with "let".
- oofabz 11y agoYou need mutability to write for loops.
- cballard 11y agoC-style for loops are discouraged in good Swift code. Use map, ranges, or for/in instead.
- usefulcat 11y agoSo.. get rid of 'x += 1' as well?
- cballard 11y agoYes! And local "var". The optimizations that "var" allows should be the job of the compiler. It's still needed at the non-local level on reference types, but could possibly be disallowed in structs as well.