On Fri, 14 Dec 2007, Sven Schreiber wrote:
Riccardo (Jack) Lucchetti schrieb:
>
> I have the feeling that nothing is wrong with "include" per se.
Yes, except that 'include ./thisfile.inp' doesn't work.
Up till now, the "./" notation for filenames has always just used
the actual current working directory, which is not necessarily the
same as "shelldir": the latter was used strictly for shell
commands, and gretl's "open", "include" and so on are not shell
commands. However, this does seem unintuitive so I'm modifying
gretl's path searching: if shelldir is set, it will be checked
first when gretl is asked to open a filename that starts with "./"
or "../".
> If my suspicion is right, your included file starts with an
> "if" statement, which is indeed illegal if no dataset is open
> (and rightly so).
But why "rightly so"? It's not at all obvious to me.
"include" is meant for function files; what you're doing here is
really a "run". But on the substantive point: "if" calls for
evaluation of a condition, which invokes the "genr" apparatus.
That apparatus assumes we have a data set in place, and will fail
in nasty ways if we don't.
One way around this would be to do the equivalent of "open
nulldata 1" automatically on program startup. This is worth
thinking about, but probably not for the 1.7.1 release. I take
your point that we now have quite a lot of things you can
usefully do in gretl without having a dataset open. Doing "open
nulldata" explicitly is not very high-cost, but perhaps it's a bit
clunky.
> If you use the if statement to de-activate a portion of the
> script unconditionally (as in "if 2>3"), it seems to me that
> commenting out the code is a much better solution.
Yeah except that AFAIK in gretl's editor it's not possible to do
it with a large chunk in one step. Or is there a hidden (or not
so hidden) way?
C-style comments "/*" and "*/" make that pretty easy, but it might
be nice to have GUI commands "comment region" and "uncomment
region" in the script editor window.
Allin.