[Gretl-devel] members of lists returned from functions

Sven Schreiber svetosch at gmx.net
Sat Feb 9 12:31:03 EST 2008


Sorry for the flood of messages from me, I'm doing some "heavy 
scripting" ATM and so I stumble over a lot of stuff...

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.)

or

2) "s1" should be properly updated when it is changed inside the 
function and then returned as a member of the list "myl".

This is on today's version from CVS.

thanks,
sven

<demo>
function test(void)
   series s1 = randgen(u,0,1)
   series s2 = randgen(u,2,3)
   list myl = s1 s2
   return list myl
end function

loop 2
   list check = test()
   print s1
end loop
</demo>


More information about the Gretl-devel mailing list