[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-gawk] SYMTAB contains future variables
From: |
Joep van Delft |
Subject: |
[bug-gawk] SYMTAB contains future variables |
Date: |
Sun, 21 Sep 2014 23:17:44 +0200 |
Hello,
Please consider the following program:
% gawk 'BEGIN{for(s in SYMTAB){print s};a=1}'
I would expect 'a' not to be in the output, as it is at the time of
the for loop, a defined global variable or array. Yet it is.
Neither inserting a sleep call with the system function between the
for-loop and the assignment, nor moving the assignment to an
END{}-block, changes the behavior.
What _does_ work, is the following trick to hide the variable name
to the interpreter:
% gawk 'BEGIN{for(s in SYMTAB){print s};SYMTAB["a"]=1}'
% gawk --version
GNU Awk 4.1.1, API: 1.1 (GNU MPFR 3.1.2-p10, GNU MP 6.0.0)
Copyright (C) 1989, 1991-2014 Free Software Foundation.
Kind regards,
Joep
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug-gawk] SYMTAB contains future variables,
Joep van Delft <=