Am 02.02.2024 um 01:42 schrieb Allin Cottrell:
However, that treatment of the "const" modifier cannot work when the
series passed is the one named "const" (with ID number 0). That series
is supposed to be automatically available at all levels of function
execution,
Well, but only if the dataset context is passed on to the called
function, right? Otherwise no series is available inside, not even
"const" (ID 0). This is the background of what I'm trying to achieve,
with a little bit of borderline hacking. I'm working with MPI and
(sometimes, not always in my general meta function) need to pass on the
dataset context. And I thought the safest way is to use the series that
always exists, namely "const".
This issue hasn't been reported before, which is not surprising since
passing series 0 as an argument is in general pointless, since it's
already available everywhere and is of no interest other than as the
intercept in a regression. I think I see a way of making it harmless
but I need to do some more testing before I'm sure.
Thanks. Again, the interest here is not the "const" series per se, but
the idea is to "piggyback" the dataset context on an arbitrarily chosen
series. But I think I can work around this particular problem; for
example, two hackish pieces of syntax that work instead of the passed
arg "const" are:
1) "(dataset)[1]" - assumes at least one other series, which is OK; not
that "dataset[1]" didn't work
2) "deflist(const)[1]" - uglier, but also works
(More background explanation: I first tried to use a gretl list that is
of more direct interest, but the problem was that this doesn't work in
the also covered case that no dataset is present. That is, I can use the
function arg specification 'series s[null]' and the null default also
works without an active dataset, but 'list L[null]' yields an error
then. I know this is because of the special behavior of lists, which
always exist even when "null-ed" or omitted. But that's causing a
problem here, hence my workaround with "const".)
If it's too dangerous to accommodate the passing of just "const" (and
since usually there isn't much point in it), perhaps it's better to just
ban it? Or perhaps ban the combination of passing "const" to a function
that uses the const modifier for its arg?
thanks
sven