I know I had nothing to do with the original post but I'll chime in for some 
quick answers.

Here's the [manual 
entry](https://nim-lang.org/docs/manual.html#procedures-var-parameters) about 
var parameters. It seems to me like you understand what they are but just in 
case here's a simple example with the basic int type.
    
    
    proc foo(a: var int) =
      a = 10
    
    var x = 7
    foo(x)
    echo x # 10
    
    
    Run

Objects are immutable out of scope, for example if you pass them to non-var 
proc arguments you can't change their properties in the proc, so you'd have to 
use var parameters. This isn't the case with ref/ptr objects though, as you 
mentioned.

You don't have access to Nim AST at runtime, so you would have to use the Nim 
compiler as an API with the [compiler nimble 
package](https://nimble.directory/pkg/compiler). You do need to know a little 
bit about the compiler to do this, however.

Reply via email to