As you probably know, we've emphasized the principle of
"encapsulation" for user-functions in gretl. One aspect of this is
that if the dataset is sub-sampled (non-contiguous observations
have been selected on some boolean criterion) on entry to a
function, you can't "un-subsample" inside the function (i.e. "smpl
full" will not give you the entire dataset as it exists at caller
level). This seems to me appropriate and I don't propose changing
it.
But we've also applied this principle to "regular" smpl setting,
where you just shift the end-points of the sample. To explain:
suppose we have a quarterly dataset that runs from 1980:1 to
2010:4. And suppose that on entry to a function the sample range
has been set by the caller to 1990:1 - 2005:4. Then inside the
function, although you can use smpl to adjust the end-points you
cannot shift them outside of the range set at the caller level.
E.g. in this case you couldn't get access to data before 1990 or
after 2005.
I'm now wondering if that is perhaps too restrictive. Bear in mind
that whatever sample is in force when a function is called will
always be restored when the function exits (again, something I do
not propose changing).
Any thoughts on this? Does it seem OK to let a function extend the
incoming sample range, provided it's then reset on exit? I think
this would make it easier to write certain kinds of potentially
useful functions.
Allin