To elaborate an immutable reference just means the reference cannot be 
reassigned but the pointed at object and all of its fields can be mutated so 
the following happens: 
    
    
    var a = 100
    a = 300 # Can reassign `a` (var int)
    assert a == 300
    let b = 100
    #b = 300 # Cannot reassign `b` (let int)
    let c = new int
    c[] = 300 # We're assigning what `c` points to which is valid
    assert c[] == 300
    #c = new int # Cannot reassign `c` (let ref T)
    var d = new int
    d[] = 400
    assert d[] == 400
    d = new int # Can reassign `d` (var ref T)
    
    
    Run

Reply via email to