On Tue, 11 Aug 2009, Sven Schreiber wrote:
Allin Cottrell schrieb:
> On Mon, 10 Aug 2009, Allin Cottrell wrote (in response to
> Zhenzeng Young):
>
>> [T]he word "to" is used by gretl in constructing ranges of lags.
>> So my command to set up the list "sysvars" went wrong -- it was
>> confused by your variable named "to". My fix for issue this was
>> to make "to" a reserved word (that is, you are no longer allowed
>> to call a variable "to").
>
> On second thoughts, there's no need to add "to" to the list of
> reserved words. By coding a bit smarter I've removed the
> ambiguity between "to" as variable name and "to" as lag range
> indicator.
>
nice and user-friendly effort of course, but isn't this very bug-prone?
You have a point, but I think we're alright. I believe the
following illustrates the toughest case for disambiguation, and we
manage it OK. That is, L1 ends up holding 3 lags of QNC, while L2
holds the three variables "PRIME", "to" and "STOCK".
open data9-7
series to = QNC
list L1 = QNC(-1 to -3)
list L2 = 4 to 6
list L1 print
list L2 print
On the other hand, even if we're bug-free in this respect, the
command
list L2 = 4 to 6
kind of looks as if it might produce a list holding vars 4, 5 and
6 (although that syntax is not in fact supported). So perhaps
there's a case for banning "to" as a variable name for the sake of
readibility in scripts?
Allin.