On Thu, 21 May 2009, yinung at Gmail wrote: > I tested the User-defined functions and found some potential errors. > For example, my function is: > > <script> > function test (series y, int order[0:2:1], string option[null]) > if option="nc" > printf "%s\n","empty" > else > printf "%s\n","no options" > end if > end function > </script> > > the argument, string option[null], above should indicate that the > "option" string should be optional. > > After normally processing it as a package, I execute this function via > GUI (the same via command line). If I choose the default "null" as > automatically specified by gretl, I got an error: > > "The symbol 'otion' is undefined... error evaluating 'if' "
I don't think there's any bug here. If the string argument to a function may be given as null, then the function writer has to test it before trying to use it: function test (series y, int order[0:2:1], string option[null]) if isstring(option) printf "option: got '%s'\n", option else print "no option given" end if end function Allin Cottrell