A function in Nim is similar to a function in math. It must not have side effect and it always returns same output from same input.
If a function use global variable, the output from the function can be changed when the value of global variable is changed. Even if your code never change that global variable, declaring it with `var` means it can be modified and you might add a code that modifys it. If compiler checks global variables used in a function is never modified and allow a function to use it, you can not add any proc that modify these global variables without changing code in the function while these global variables declared with `var`.