: <i>Callback for unset trace on namespace variable has inexplicable effect on its visibility</i> plus 6 other changes
by
.
D 2025-02-20T13:56:01.577
J closedate 2460727.08057381
J closer sebres
J icomment This\sis\sfully\sexpected\sbehaviour\sand\scan\sbe\ssimply\sexplained:\r\n\r\nInvocation\sof\s`variable\sx`\swithout\svalue\sin\sa\sproc-frame\sdoesn't\srestore\sthe\svariable,\sso\safter\sall\sthe\sunset-trace\swould\snot\sretain\sit\sand\svariable\sgets\sdeleted\shereafter\s(by\sthe\sway\stogether\swith\sthe\strace).\r\nBasically\s`variable`\swithout\svalue\sonly\screates\sa\slink\sin\slocal\sproc-frame\s(scope),\swhich\sthen\spoints\sto\snon-existing\svariable.\sAnd\sif\strace\sleaves\sthe\sproc\scallback,\sthis\slocal\slink\sgets\sremoved\stogether\swith\sthe\sproc-frame.\r\n\r\nSo\sone\shas\sto\sset\svariable\sin\strace-callkback\s(e.\sg.\swith\s`variable\sx\ssome-val`)\sthen\sit'd\sbe\sretained.\sOtherwise\sit\swill\sbe\salways\sremoved\sby\sunset.\r\n\r\nEven\sin\sa\sNS\sor\sglobal\slevel,\s`variable\sx`\swould\snot\sreally\screate\sa\svariable,\sbut\srather\sa\slink\sto\svar\s(which\sstill\sdoesn't\sexist):\r\n```\r\n%\svariable\sx\r\n%\slist\s[info\svars\sx]\s[info\sexists\sx]\r\nx\s0\r\n```\r\n\r\nAs\sfor\sthe\scase\sby\srepeat,\sit\sis\salso\spretty\sobvious:\sthe\sunset\sof\svariable\salso\sremoves\sits\strace,\sso\sone\shas\sto\sregister\sit\sagain\sif\sneeded.\r\n\r\nHere\sis\sa\scode\sthat\shopefully\sexplains\sit:\r\n```\r\n%\strace\sadd\svariable\sx\sunset\s{apply\s{args\s{puts\s"**\s$args";\svariable\sx}}}\r\n%\sunset\s-nocomplain\sx\r\n**\sx\s{}\sunset\r\n%\slist\s[info\svars\sx]\s[info\sexists\sx]\r\n{}\s0\r\n%\strace\sadd\svariable\sx\sunset\s{apply\s{args\s{puts\s"**\s$args";\svariable\sx\s"restored"}}}\r\n%\slist\s[info\svars\sx]\s[info\sexists\sx]\r\n{}\s0\r\n%\sunset\s-nocomplain\sx\r\n**\sx\s{}\sunset\r\n%\slist\s[info\svars\sx]\s[info\sexists\sx]\r\nx\s1\r\n```\r\n\r\nThus\sclosed\sas\sinvalid.
J login sebres
J mimetype text/x-markdown
J resolution Invalid
J status Closed
K 58fa7cc7f88d70c467ccf57fac9dbc532509277f
U sebres
Z 416d3d25d6c7d3c6e32f01fbae0db1fe