View types in experimental features seems safe alternative. 
<https://nim-lang.github.io/Nim/manual_experimental.html#view-types>

Following code contains neither `cast`, `addr` nor `unsafeAddr` but dangerous. 
    
    
    proc test(x: var int; s: var seq[int]) =
      s.setLen(4)
      x = 1
    
    var s = @[0]
    test(s[0], s)
    echo s
    
    
    Run

This code would become compile error when "Aliasing restrictions in parameter 
passing" is implemented. 
<https://nim-lang.github.io/Nim/manual_experimental.html#aliasing-restrictions-in-parameter-passing>

Reply via email to