|
2007-07-07
| ||
| 21:08 | • Deleted ticket [1749596fff]: upvar and unset and traces: change in HEAD correct?... artifact: 3b0d0fc3d1 user: msofer | |
| 20:58 | • Ticket [1749596fff]: 4 changes artifact: 8b2c98fc2c user: msofer | |
| 20:51 | • Ticket [1749596fff]: 4 changes artifact: 6431afdee1 user: msofer | |
| 13:45 | • New ticket [1749596fff]. artifact: 2c8dcee006 user: msofer | |
upvar and unset and traces: change in HEAD correct?
Deleted1749596fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 19 years ago
Descriptionplain2007-07-07 13:45:29
mig@uh:~$ tclsh8.4
% upvar 0 a(x) y
% proc moo args {trace add variable ::a(x) unset moo; set ::y 1}
% moo
1
% unset a
% parray a
% set y
can't read "y": no such variable
% set y 1
can't set "y": upvar refers to element in deleted array
versus
mig@uh:~$ /home/CVS/tcl_SF_clean/unix/tclsh
% upvar 0 a(x) y
% proc moo args {trace add variable ::a(x) unset moo; set ::y 1}
% moo
1
% set y
1
% parray a
a(x) = 1
What this means is that upvar in HEAD has snapshot semantics that are "less pure" than 8.4
msoferplain2007-07-07 20:51:13
Logged In: YES
user_id=148712
Originator: YES
OTOH both versions react similarly (impure snapshot semantics) to unsetting the element:
% upvar 0 a(x) y
% proc moo args {trace add variable ::a(x) unset moo; set ::y 1}
% moo
1
% unset a(x)
% set y
1
msoferplain2007-07-07 20:58:24
Logged In: YES user_id=148712 Originator: YES Tcl8.0.5 and Tcl8.3.4 behave just like Tcl8.4 in this respect - HEAD is really innovating, 8.5a5 has the traditional behaviour. This is due to the recent "streamlining" changes in variable deletion :(
msoferplain2007-07-07 21:08:42
Logged In: YES user_id=148712 Originator: YES Stupid pilot error: same behaviour if the scripts really are identical, forgot the 'unset' in HEAD.
Log in (anonymous is fine) to add a comment.