Am 07.01.2015 um 21:33 schrieb Riccardo (Jack) Lucchetti:
On Wed, 7 Jan 2015, Sven Schreiber wrote:
>
> Now I have the following debug code inside this function, and I report
> the output as comments:
>
> # should give 0, since 'thresh' exists in the function's scope:
> check = isnull(thresh)
> # but actually gives 1:
> print check
> # but in this very next line, 'thresh' is accepted (no error):
> string mys = argname(thresh)
> # and gives the correct passed argument's name "ave_inc_gr":
> print mys
>
> This feels very weird, or am I blind and missing something obvious?
Careful: isnull() doesn't mean "isn't there": it means "it's
there, and
takes the value 'null'".
Suppose you're right and 'thresh' has the value 'null', then why does
argname(thresh) return (correctly) "ave_inc_gr"? And in reality I was
trying to do something useful (of course!) with the series ave_inc_gr
inside the function, and got the error "no such symbol" or "doesn't
exist" or something like that. The isnull() thingy is just another test
I did to pinpoint the problem.
BTW, the doc about isnull() says the question is whether the arg "is the
identifier for a currently defined object". This is not quite the
definition that you gave.
Finally, I had used the function before, and it had worked ok. Of course
I can never rule out 100% that something else hasn't changed, but I
think there is a chance that this is new gretl behavior for some reason.
thanks,
sven