On Sat, 13 Oct 2018, oleg_komashko(a)ukr.net wrote:
Dear all,
Below is a script illustrating the problem
# creates list of all global series
function list fun1(void)
list retlist = seq(1,$nvars-1)
return retlist
end function
# identity list function
function list fun2(list a_list)
return a_list
end function
# checking function
function void fu(string name)
catch eval @name
err = $error
if err
printf "Variable %s is not defined\n", name
endif
end function
#contaminating function
function void spoil(void)
list list1 = fun1()
list list2 = fun2(list1)
end function
###### example
nulldata 20
set seed 13
x1 = normal()
# before
fu("x1")
# looking at x1
print x1
# spoiling
spoil()
# after
fu("x1")
On the first run fu("x1") does not know
global series 'x1' but after running spoil()
fu("x1") knows and evaluates x1
Thanks, Oleh. I see what the problem is here and I have an idea of how
to fix it, but I can't work on it until tomorrow.
Allin