On Thu, 11 Nov 2010, Sven Schreiber wrote:
Hi, some function programming issues/remarks:
1. Shouldn't the following work according to the example
"function series get_uhat_and_ess(series y, list xvars, scalar
*ess[null])" in the manual:
<script>
function void check(int myarg1, int myarg2[null])
print "yes"
end function
check(1)
</script>
But I get:
gretl-Version 1.9.2cvs
Aktuelle Sitzung: 2010-11-11 20:22
? function void check(int myarg1, int myarg2[null])
Syntax-Fehler in Befehlszeile
Fehler bei Skriptausführung: Stopp
> function void check(int myarg1, int myarg2[null]) ...
If myarg2 is supposed to be a plain integer, it's not the sort of
thing that can be "null" -- only pointer argument can default to
null. Using "int myarg2[0]" would work (myarg2 default to zero).
2. functions apparently cannot return bool or int (documented by
running the trivial ones below). Note that I'm fine with this if
it's desired behavior, but maybe it isn't...
It's not unintended, at any rate. Our assumption so far has been
that this (i.e. distinguishing between "bool", "int" and
"scalar")
is only necessary or useful for function arguments. (Internally,
all such values are floating-point numbers.)
Allin