On Sat, 9 Feb 2008, Sven Schreiber wrote:
The example script below prints two identical series under the
name of "s1", which is "obviously" wrong, although I'm not sure
which would be the correct behavior -- I can think of two
correct variants:
1) "s1" and "s2" are in the namespace of test() and thus should
not be accessible at all, so the script should raise an error.
(Although then it's not quite clear how to access the members of
the returned list.)
No, s1 and s2 are moved to the namespace of the caller when the
caller make use of (assigns) the list return. That's by design.
2) "s1" should be properly updated when it is changed
inside the
function and then returned as a member of the list "myl".
Yes. There's something wrong here. I notice that it works as
expected if you give the list itself as an argument to "print":
function test(void)
series s1 = randgen(u,0,1)
series s2 = randgen(u,2,3)
list myl = s1 s2
return list myl
end function
nulldata 10
loop 2
list check = test()
print check -o
end loop
I'll try to work out what's happening when you print "s1" rather
than "check".
Allin