<i>TIP 636 Tcl_ListObjIndex incompatibility not documented</i> status still Open with 3 other changes
by
.
D 2024-12-02T09:43:35.728
J icomment The\shairiest\shair\son\sthe\smonster\shappens\swhen\sthe\scalled\sfunction\sdecrements\sthe\sreference\scount\sof\sthe\sobject\sback\sto\szero.\sThis\sdefinitely\shappens\sin\s`Tcl_EvalObj()`\sin\ssome\scases,\sbut\sfor\s`Tcl_ObjSetVar2()`\sis\sonly\sever\slikely\sto\sbe\sa\sfactor\sfor\sthe\skeyObj\sand\svalueObj\sarguments\sif\sthere\sare\straces\sin\splay\s(as\sthose\scould\seffectively\sreject\sor\sreplace\sthe\swrite).\r\n\r\n##\sBackground\r\n\r\nFor\s***untraced***\svariables,\sthe\sreference\scount\schanges\sare:\r\n\r\n\s*\s`nameObj`:\sdon't\sincrement\sreference\scount\r\n\s*\s`keyObj`:\sincrement\sreference\scount\s_only_\swhen\snew\sarray\selement\sis\sallocated\r\n\s*\s`valueObj`:\sincrement\sreference\scount\s_only_\son\ssuccessful\swrite\r\n\r\n**Constants**\sreject\swrites\sprior\sto\sreference\scounts\sbeing\supdated,\sand\sdon't\sapply\sto\sarrays\sor\stheir\selements\s(because\sthere\swas\sa\scase\sin\sthere\sthat\smade\smy\shead\sache\sand\sit\swas\seasier\sto\sjust\sblock\ssafely\sand\slet\ssomeone\selse\senable\swhen\sthey\sfigure\sout\swhat\sa\sconstant\sarray\smeans\sand\show\syou'd\sactually\smake\sit).\sThis\ssort\sof\sthing\sis\swhy\sI\smade\sconstants\sa\sseparate\sthing,\sdespite\sit\sbeing\spossible\sto\ssimulate\sthem\swith\straces/links\sin\solder\sversions\sof\sTcl.\r\n\r\n**Traces**\stypically\sinvolve\scallbacks\sinto\sthe\sTcl\sinterpreter\swith\sno\srestrictions,\sand\shappen\safter\sthe\swrite\shas\sbeen\sdone,\sso\sreference\scount\supdates\scan\sgo\sdown\sin\sthat\scase\s(e.g.,\sbecause\sa\swhole\sarray\strace\sremoves\sthe\selement\syou've\sjust\smade)\sand\sfull\shairiness\sis\sachieved;\sboth\sthe\skey\sand\sthe\svalue\sarguments\shave\stheir\sreference\scounts\sdecreased\sback\sto\stheir\sstart\svalue\sbefore\sthe\scall\sto\s`Tcl_ObjSetVar2`\sexits\s(i.e.,\sthe\shandles\sare\snot\ssafe\sto\suse\safter\sexit\sat\sall).
J login dkf
J mimetype text/x-markdown
K b343fe8656c16b2e02580f68423b6ef03463915c
U dkf
Z 3ab50cada9990c54fe17f6a098ea6b53