Artifacts Associated With Ticket ace7bf3dcff30d64
Ticket change [11ef093910] (rid 138261) by cmcc on 2014-05-25 21:52:17:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Per the code below, I would have expected the upvar'd element modification to trigger the array trace as well as the element trace. I accept that this may be a lot of work and complexity for what is a corner case. I suggest that the documentation specify the behaviour in this case. variable V; array set V {} proc eincr {} { upvar #0 V(a) a incr a } proc aincr {} { upvar #0 V V incr V(a) } proc varmod {args} { puts stderr "varmod: $args" } ::trace add variable V(a) {write unset} [list varmod element] ::trace add variable V {write unset} [list varmod array] puts stderr "global set" set V(a) 1 ;# triggers array and element traces puts stderr "upvar array element set" aincr ;# triggers array and element traces puts stderr "upvar element set" eincr ;# triggers only element trace - foundin initialized to: "8.6"
- is_private initialized to: "0"
- login: "cmcc"
- priority initialized to: "5 Medium"
- private_contact initialized to: "16910d69b11045755316a073070779a85cd9218f"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "cmcc"
- subsystem initialized to: "46. Traces"
- title initialized to: "trace on upvar'd arrays appears inconsistent"
- type initialized to: "Patch"
Ticket change [8916c10be6] (rid 138262) by dgp on 2014-05-26 13:03:57:
- icomment:
How does this relate to http://core.tcl.tk/tcl/tktview?name=572889 ?
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [d4b29c01b0] (rid 138263) by dgp on 2014-05-26 13:09:51:
- icomment:
Not quite a Dup, I guess, since one is about read and the other about write traces, but I bet a common patch could take care of both. Note the doc excerpt in the other ticket, that this behavior, though unwelcome, is apparently documented. It *may* be connected to (earlier?) implementations of ::env variable maintenance.
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [6ee31af049] (rid 138264) by msofer on 2014-05-26 13:27:11:
- icomment:
It is a dup in my mind, as they require the same changes to fix AND we would want to keep things consistent anyway. The problem is that array elements do not know which array they belong to - in order to solve this we would have to expand the Var struct, or else treat links to array elements differently.
- login: "msofer"
- mimetype: "text/plain"
- icomment: