Short answer: You need to use `ref History` instead of `var History`.

Longer answer: A `var` argument is only valid for the duration of the call to 
the proc. This is why it cannot be captured by a closure (your nested proc) -- 
there's no guarantee that the argument would still be available upon exit. 
Using a `ref` allows multiple references to the same data structure and 
guarantees that the data won't be released (garbage collected) until all of the 
references go out of scope.

Hope this helps! 

Reply via email to