4 ms·
You are correct. But in FP, we understand immutability differently, so it becomes very painful to watch structural equivalence of the following variables: clas
by lionet 11y ago
You are correct. But in FP, we understand immutability differently, so it becomes very painful to watch structural equivalence of the following variables:
class Foo { var x = 0 }
let a = [Foo(), Foo(), Foo()]
var b = a
a[0].x = 1
var c = b // [0].x == 1 ;(
let d = a // [0].x == 1 ;(