Here's what I mean:
    
    
    import parseopt
    
    proc myfunc(p: var OptParser) =
      let a = p.key
      echo "Before first p.next(), a is " & a
      p.next()
      echo "a is now: " & a
      
      var b = p.key
      echo "Before second p.next(), b is " & b
      p.next()
      echo "b is now: " & b
    
    var p = initOptParser("a b")
    p.next()
    myfunc(p)
    
    
    Run

If you run this, b will have the proper value, but a will be empty once 
`p.next()` runs.

This is a small part of a larger program, where let a was a variable capsule, 
and var b was a variable cwd. This is what the generated C code looks like:
    
    
    capsule = (*p).key;
            nimln_(390, "bluecap.nim");
            nponext(p);
            nimln_(391, "bluecap.nim");
            cwd = copyString((*p).key);
    
    
    Run

cwd is copied, but capsule isn't.

Should I file this as a bug? Asking here first because I'm not sure if it's 
been fixed since 0.19 was released.

Reply via email to