Am 24.09.2018 um 15:12 schrieb Allin Cottrell:
On Mon, 24 Sep 2018, Sven Schreiber wrote:
> I wonder how gretl interpreted that "1 to 5" part...
Hmm, gretl is trying to treat this as a "count" loop, with the string
"i = 1 to 5" as a candidate expression for producing the number of
iterations on evaluation. This is, I notice, an undocumented extension
of the count loop syntax (the doc says the number of iters should be a
numeric constant or the name of a scalar variable).
Ah, I see.
What should we do? It would be easy to enforce the documented count
loop syntax -- and therefore flag a syntax error up-front in this
case. But I wonder if there's any usage of the extended count-loop
syntax out there among extant hansl scripts. The sort of thing one
might reasonably expect to work (even though it's contrary to doc)
would be, "loop K/2", "loop N-M" and such.
In principle using an expression there could indeed be useful. What
would already be helpful is gretl saying something like "failed to
evaluate loop count expression, object i is undefined", or similar.