a couple simple illustrations:
    
    
    proc sinkingLen(x: sink seq[int]):int = x.len
    var s = @[1,2,3,4]
    echo s.sinkingLen
    
    
    Run

this warns, because s is a global variable. you can either explicitly move s: 
    
    
    echo sinkingLen(move(s))
    echo s #s becomes @[] after the move
    
    
    Run

or wrap everything in a `main` proc
    
    
    proc main()=
      var s = @[1,2,3,4]
      echo s.sinkingLen
      echo s
    
    
    Run

but wait, here s is used after sinking into `sinkingLen`, so the compiler still 
warns. you can solve this by rearranging: 
    
    
    proc main()=
      var s = @[1,2,3,4]
      echo s
      echo s.sinkingLen
    
    
    Run

Reply via email to