Interestingly, this seems to work correctly: 
    
    
    proc p() =
      var a = @[0, 1, 2, 3]
      discard a.pop
      var b = a # note the change from `let` to `var`
      a.add(5)
      echo a  # @[0, 1, 2, 5]
      echo b  # @[0, 1, 2]
    
    p()
    

Looks like an optimization gone wrong. Perhaps the intent was for the sharing 
to happen between two `let` s.

[EDIT]

Looks like Iscrd beat me to it.

Reply via email to