On Thu, 3 Apr 2008, Allin Cottrell wrote:
The simple fix, I think, is not to decrement i until we know that
the variable in question really has been deleted. However, this
issue raises the question of whether the last model estimated
within a function that is returning should really be treated as
the "last model".
For now, I'm committing the "simple fix" to CVS just so you can
take a look.
I can confirm that the "simple fix" lets Sven's script and my example
script run, but the problem remains of the workspace being contaminated by
several local variables being promoted to global.
I'm in favour of removing from the stack all locally estimated models. The
only thing we lose is not being able to use dollar accessors immediately
after a function, eg in
<script>
function foo(series x, series y)
var 1 x y
end function
nulldata 10
x = normal()
y = normal()
foo(x,y)
A = $coeff
print A
</script>
which works now, but wouldn't after my proposed change. But I'm personally
ok with this, it's bad syntax anyway.
Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche
r.lucchetti(a)univpm.it
http://www.econ.univpm.it/lucchetti