Am 24.05.2017 um 16:36 schrieb Allin Cottrell:
On Wed, 24 May 2017, Sven Schreiber wrote:
> Hi,
>
> I'm seeing a difference in the output between what (I think) is the
> same code, depending on whether it is called as a function package or
> whether it is run as unpackaged scripts. With the package (run with
> gretlcli.exe) from the CLI I'm getting warnings:
>
> <gretl-output>
> In regard to function VARboot (package johansensmall):
> Warnung: erzeugte nichtendliche Werte
> </gretl-output>
>
> (meaning "created non-finite values")
>
> And when I run the some code with gretlcli but not in a packaged form,
> those warnings are absent. I have inserted a "set warnings off" into
> that code where I think it could be necessary, and I would like to
> mute those warnings also in the package.
>
> So my question is: What could explain this different behavior? Is it
> intended? How to switch off the warnings inside a package?
I created a trivial gfn that produces a matrix with a NaN in it, then
ran a script that calls it, as follows:
include ./warntest.gfn
nulldata 10
set verbose off
matrix M = myfun()
print M
In this case I saw the message
In regard to function myfun (package warntest):
Warning: generated non-finite values
However, if I inserted "set warnings off" in the caller that suppressed
the message. So I'm not sure what's happening in your case. Could you
perhaps send me a caller for johansensmall.gfn that provokes a warning?
(BTW, I'm using a private new version johansensmall.gfn, the earlier one
doesn't have the set warnings off thing.)
I think I see the same thing as you when I let the caller do set
warnings off. But first I'd like to handle this in the package without
bothering the caller. And secondly I don't understand why it makes a
difference when the code is packaged.
thanks,
sven