HN user

lionet

3 karma
Posts0
Comments5
View on HN
No posts found.

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 ;(