|
2005-10-05
| ||
| 12:36 | • Closed ticket [1080627fff]: unpredictable env+upvar plus 7 other changes artifact: 3e78d6eabb user: hobbs | |
|
2004-12-07
| ||
| 22:24 | • Ticket [1080627fff]: 3 changes artifact: 45b85479f0 user: dkf | |
| 21:39 | • Ticket [1080627fff]: 4 changes artifact: 804914eef5 user: florim | |
| 13:48 | • New ticket [1080627fff]. artifact: dc1f5007a0 user: nobody | |
unpredictable env+upvar
Closed / Duplicate1080627fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 21 years ago
Descriptionplain2004-12-07 13:48:29
See comp.lang.tcl 2004-12-06 "very weird effect!".
---------------------------
proc myapp {bn} { upvar 1 $bn b; append b xx }
set env(XY) aa
myapp env(XY)
#puts "$env(XY)"
#append env(XY) yy
puts "$env(XY)"
----------------------------
As is, it writes just "aa"
If you only uncomment the append-line
then it writes "aaxxyy"
If you then also uncomment the puts-line between
myapp and append, then the "xx" is lost,
and the script will just write "aa" and "aayy"
- Very, weird, indeed.
-----------------------------
Tested on:
WindowsXP + Tcl8.4.8
and by Andreas Leitgeb on:
tcl8.4.7 and with CVS-version 8.5 on linux
florimplain2004-12-07 21:39:34
Logged In: YES user_id=1173505 submitted by: florim
dkf Ticket [1080627fff]: 3 changes
[History diff]2004-12-07 22:24:04
hobbsplain2005-10-05 12:36:29
Logged In: YES user_id=72656 dup of 219372
Log in (anonymous is fine) to add a comment.