...; if possible, rearrange your program's control flow to prevent it.
This is a common hint message I've been getting.
Are there any guidelines as to how to deal with that? (I know about move, but I'm not really sure what it implies...)
a couple simple illustrations:
proc sinkingLen(x: sink seq[int]):int = x.len
var s = @[1,2,3,4]
echo s.sinkingLen
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
or wrap everything in a main proc
proc main()=
var s = @[1,2,3,4]
echo s.sinkingLen
echo s
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
Nice explanation. Thanks!
I'll give it a try to see the results...