Skip to content
Tcl Source Code Artifact [667ffd5e7d]
Login

Artifact [667ffd5e7d]

Artifact 667ffd5e7dd32f7a7a422121a15563173a81efd1e63e5317f7c295c50c10d2f3:

Ticket change [667ffd5e7d] - Ticket [2969488fffffffff|2969488fff] <i>trace variable doesn&#39;t fire if you upvar to an array element</i> status still Open with 6 other changes by sbron on 2022-08-17 11:06:39.
D 2022-08-17T11:06:39.880
J closer nobody
J comment (This\sis\sFR\s572889\sfrom\sJune\s2002\sconverted\sto\sa\sbug)\r\n\r\nTcl\sVersions:\sall\s8.4\sand\sonwards;\sconfirmed\son\s8.4.11\sand\s8.6b1.1\r\nOS\splatform\sand\sversion:\sprobably\sall,\sconfirmed\son\sWindows\sXP\s+\sSP3\r\n\r\nProblem\sbehaviour:\r\nIf\syou\sset\sa\strace\son\san\sarray,\sthen\slink\sto\sa\sspecific\selement\sof\sthat\sarray\susing\s[upvar],\sany\schanges\smade\svia\sthe\slinked\svariable\swill\snot\scause\straces\sto\sfire.\r\n\r\nExpected\sbehaviour:\r\nIf\sa\strace\shas\sbeen\splaced\son\sa\svariable,\sany\saccess\sto\sthat\svariable\s(even\sindirectly)\sshould\sinvoke\sthe\strace.\r\n\r\nAdditional\sdetail\s/\sUse\scase\r\nI\shave\sa\s"fileentry"\smegawidget\sthat\scombines\san\sentry,\sa\sbutton\swith\san\sicon,\sand\sa\stk_getOpenFile\s/\stk_getSaveFile.\s\sIf\sthe\sbutton\sis\sclicked\sthe\sappropriate\sfile\sdialog\sis\sdisplayed,\sand\sthe\sselected\sfilename\swritten\sback\sinto\sthe\s-textvariable.\s\sThe\sobvious\simplementation\sis\sto\slink\sto\sthe\s-textvariable\susing\s[upvar].\s\sIf\sthe\s-textvariable\sis\san\sarray\selement\sthen\straces\son\sthe\selement\swill\snot\sfire.\s\sIn\sthis\scase\sI\sam\susing\svariable\straces\sto\smaintain\sconsistency\sbetween\svarious\sUI\sfields,\sso\sI\slose\sconsistency\sif\sthe\strace\sdoesn't\sfire.\r\n\r\nWorkarounds\r\n(1)\sChange\sthe\sUI\sto\suse\sa\sscalar\srather\sthan\san\sarray\selement\sfor\sthis\sfield\r\n(2)\sset\sand\sdereference\sthe\svarname\sgiven\sby\s-textvariable\sdirectly\srather\sthan\susing\s[upvar]\r\n(3)\shave\sthe\smegawidget\suse\sthe\sentry's\sget/insert/delete\smethods\srather\sthan\saccessing\s-textvariable.\r\n\r\nCode\ssample\r\n---\r\nproc\stracer\s{args}\s{\sputs\s"<trace>\s$args"\s}\r\nset\sui(field1)\s"alpha"\r\ntrace\sadd\svariable\sui\swrite\s"tracer\swrite"\r\ntrace\sadd\svariable\sui\sarray\s"tracer\sarray"\r\n\r\nset\sui(field1)\s"beta"\s;#\strace\swrite\sfires\r\narray\sset\sui\s{field1\s"gamma"}\s;#\strace\swrite\s&\sarray\sboth\sfire\r\n\r\nproc\salter\s{varname}\s{\r\n\s\supvar\s#0\s$varname\sv\r\n\s\sset\sv\s"delta"\r\n}\r\n\r\nalter\sui(field1)\s;#\strace\sdoesn't\sfire\r\n---
J icomment I\sjust\sran\sinto\sthis\sproblem\sagain\stoday.\sConsidering\sthe\smultiple\sbug\sreports\sof\ssimilar\sissues\sover\sthe\slast\s20\syears,\sI'm\sclearly\snot\sthe\sonly\sone.\r\n\r\nTcl\s9.0\sseems\slike\sthe\sperfect\sopportunity\sto\srectify\sthe\ssituation.\sCan\sthe\sfix\sattached\sto\sthis\sticket\splease\smake\sit\sinto\s9.0?
J login sbron
J mimetype text/x-fossil-wiki
J severity Minor
K 2969488fffffffffffffffffffffffffffffffff
U sbron
Z 47c6176a9270704076eef39fd32680b1