Re: What does "cannot be captured as it would violate memory safety" mean?
You can use `ptr T` instead of `var T` then, but beware, it's unsafe. It's better to do this instead: proc outer(x: var string) = proc inner(x: var string) = x.add "abc" inner(x) var g = "x" outer(g) echo g Run
Re: What does "cannot be captured as it would violate memory safety" mean?
The variable is sent as a var to a proc where it works fine. But I then in that proc I pass it to another proc and in that one I get the error. I've also tried passing it to the other proc without var (since in that data is only read) but get the same error. Is there an alternative to var that would work?
Re: What does "cannot be captured as it would violate memory safety" mean?
You are probably trying to use a `var` parameter somewhere you shouldn't like a closure.
What does "cannot be captured as it would violate memory safety" mean?
In some situations I get the error message _" cannot be captured as it would violate memory safety"_. I understand that this means nim is trying to stop me shooting myself in the foot, but is there anywhere I can read an explanation and if it is possible to do what I want without triggering this error?