code:

> 
>     proc f(t: seq[string]) =
>       echo "f:", cast[int](t.addr)
>     
>     proc fv(t: var seq[string]) =
>       echo "fv:", cast[int](t.addr)
>     
>     var t = @["foo", "bar"]
>     echo "t:", cast[int](t.addr)
>     
>     f t
>     fv t
>      
>      
>     
>     Run

  * result



> 
>     t: 94578224415136
>     f:140724500006944
>     fv:94578224415136
>      
>     
>     Run
    
    
     Since non-var parameters cannot be modified the compiler is always free to
    pass arguments by reference if it considers it can speed up execution.
    
    
    Run

But I saw this sentence from Nim Manual, which made me a little puzzled 🤔

Reply via email to