On Fri, 18 Mar 2016, Javier Sansa wrote:
I have just tried the last snapshot and I have run an old script
that
renames a variable within a loop
Something like:
loop for i = 1..j --quiet
...
rename T$i @a
...
end loop
and I get the message
"Sorry, this command is not available in loop mode"
"Error executing script: halting"
Using rename within a loop was allowed up to (and including) version
2016a, which leads me to question: Is it a new feature or a bug?
It's deliberate, not a bug, but we may want to reconsider it before
releasing gretl 2016b.
The point is that we now have various optimizations for improving
the performance of loops ("compilation" to one degree or another),
the integrity of which may be threatened if series change their
names mid-stream. It should be OK if you're just using a loop to
change the names of several series, but combining name-changes with
actual calculations involving series has the potential to mess
things up.
I'll take another look at this and see if we can come up with
something short of a blanket ban on using "rename" in loops that
would meet the objective of ensuring that renaming doesn't produce
wrong results or crashes.
Allin Cottrell