Hacker News new | ask | show | jobs
by lionet 3851 days 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 ;(