This is an interesting effect of tailcalls. If you write a function like:
function foo()
{
local val = eval("...something...")
return val
}
This will evaluate the string within the global environment of foo(), as expected.
However:
function foo()
{
return eval("...something...")
}
Same effect, right? Wrong. Since eval is tailcalled, the interpreter loses the information about what environment to use. foo's stack frame is overwritten by eval's. So it ends up using the environment of the function that called foo (and if foo itself was tailcalled, the environment of the function that called it, and if that was tailcalled... etc.). In other words, you don't know what environment it'll be evaluated in unless you're careful about how you call it.
In order to ameliorate this, it will be changed so that eval/loadString use the global namespace by default, and you'll be able to pass a namespace to use explicitly.