On Sat, 19 Jul 2008, Allin Cottrell wrote:
The way PROTECT_LISTS works at present, the key point is not
whether we're inside a function as such, but whether the list over
which we're looping, using "foreach", has been made available as a
function argument, or is "native" to the current level of function
execution.
Ah, ok, this is clear to me now, thanks.
I think it's inevitable that there has to be some such
difference.
I agree that we need to think some more about what's the least
confusing way of handling the issue.
Would I be wrong if I summarised the current state of affairs (with
PROTECT_LISTS=1) as follows?
List is local: $i returns a string and $i_foo is a valid identifier and
genr $i_foo = normal()
is a valid statement.
List comes "from the outside" as a function argument: $i returns a number
and $i_foo is _not_ a valid identifier. To get the same effect as above,
you need to work with strings, as in
sprintf vnam "%s_foo", varname($i)
genr @vnam = normal()
Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche
r.lucchetti(a)univpm.it
http://www.econ.univpm.it/lucchetti