On Sat, 15 Apr 2017, Allin Cottrell wrote:
Open two .inp files in the script editor: one that defines a
function and another that includes the first and calls the
function. Put a deliberate error in the function, run the caller:
error. Fix the error in the function script and save it. Run the
caller: no error. Reinstate the error and save, run caller: error.
And so on for a few iterations. So all OK.
However... when I first tried this I thought I had replicated the
problem you describe: kept on getting the "the error" even after
correcting and saving the function script! Then I realized that
there was an error in the caller that happened to "mimic" the
deliberate one in the function script, in that the undefined
symbol had the same name in each case.
P.S. keep in mind "set debug 2" if you want to see explicitly what's
going on with levels of function execution.
<sample-output>
? include functest.inp
/home/allin/gretl-git/build/cli/functest.inp
? set debug 2
? scalar z = 5
Generated scalar z = 5
? eval foo(z)
*** executing function foo
? # N = 7
? return x*N
*** exiting function foo, returning to main
The symbol 'N' is undefined
*** error in function foo, line 2
x*N
</sample-output>
Allin