The interplay of `let` and `var` get interesting with deep immutability:

While this must not compile:
    
    
    proc p1(n: Node) =
      let x = n
      var v = y
      v.data = "change" # invalid, possible alias of ``n``
    
    
    Run

This one could or could not:
    
    
    proc p2() =
      let x = Node(...)
      var v = x # valid
      v.data = "change" # invalid, declare ``x`` as ``var`` to make it compile?
    
    
    Run

Reply via email to