Skip to content
Tcl Source Code Artifact [8a03545e3a]
Login

Artifact [8a03545e3a]

Artifact 8a03545e3a889e77ffb57b69fac2a98a796e1666:

Ticket change [8a03545e3a] - New ticket [197e2bf85c08b9f4|197e2bf85c] <i>info frame &#39;level&#39; does not match documentation</i>. by anonymous on 2013-07-14 07:53:48.
D 2013-07-14T07:53:48.586
J assignee nobody
J closer nobody
J cmimetype text/plain
J comment This\sis\sprobably\san\serror\sin\sthe\sdocumentation,\snot\sin\sthe\scommand.\r\n\r\n"info\sframe"\sreturns\sa\sdict\swith\sa\s'level'\sentry,\sdefined\sas\r\n\r\n>\slevel\r\n>\s\s\s\sThis\sentry\sis\spresent\sonly\sif\sthe\squeried\sframe\shas\sa\scorresponding\sframe\sreturned\sby\sinfo\slevel.\r\n>\sIt\sprovides\sthe\sindex\sof\sthis\sframe,\srelative\sto\sthe\scurrent\slevel\s(0\sand\snegative\snumbers).\r\n\r\nThat\sisn't\swhat\sactually\shappens.\sWhat\shappens\sappears\sto\sbe:\r\n1.\sThe\slevel\sis\sindeed\sa\srelative\slevel,\sbut\suses\sthe\sconvention\sof\s'uplevel',\snot\s'info\slevel',\snamely\s0\sor\sa\spositive\snumber.\r\n2.\s"corresponding"\sis\srather\svague,\sbut\sit\sseems\smore\saccurate\sto\ssay\sthat\s'level'\sis\sthe\scaller's\slevel\srather\sthan\sthe\slevel\sof\sthe\sframe\sitself.\r\n3.\sAs\sfar\sas\sI\scan\stell,\s'level'\sis\salways\spresent.\r\n\r\nTaken\stogether,\sthis\sis\ssufficiently\sdifferent\sthat\sthe\sactual\svalues\sare\shard\sto\sinterpret.\sExample:\r\n\r\nset\sx\s10\r\n\r\nproc\stst\s{x}\s{\r\n\s\s\s\sincr\sx\r\n\s\s\s\seval\seval\stst2\s$x\r\n}\r\n\r\nproc\stst2\s{x}\s{\r\n\s\s\s\sincr\sx\r\n\s\s\s\sset\sdepth\s[info\slevel]\r\n\s\s\s\sfor\s{set\si\s$depth}\s{$i\s>\s0}\s{incr\si\s-1}\s{\r\n\s\s\s\s\s\s\s\sset\srel\s[expr\s$i\s-\s$depth]\r\n\s\s\s\s\s\s\s\sputs\s"level\s$i\s($rel)\s=\s[info\slevel\s$i]"\r\n\s\s\s\s}\r\n\s\s\s\sset\sdepth\s[info\sframe]\r\n\s\s\s\sfor\s{set\si\s$depth}\s{$i\s>\s0}\s{incr\si\s-1}\s{\r\n\s\s\s\s\s\s\s\sset\sframe\s[info\sframe\s$i]\r\n\s\s\s\s\s\s\s\sset\slevel\s[dict\sget\s$frame\slevel]\r\n\s\s\s\s\s\s\s\sset\srel\s[expr\s$i\s-\s$depth]\r\n\s\s\s\s\s\s\s\sputs\s"frame\s$i\s($rel)\s->\slevel\s$level\s([dict\sget\s$frame\scmd])"\r\n\s\s\s\s}\r\n}\r\n\r\nWhen\scalled\sas\s"tst\s$x"\sthis\sprints\r\n\r\nlevel\s2\s(0)\s=\stst2\s11\r\nlevel\s1\s(-1)\s=\stst\s10\r\nframe\s5\s(0)\s->\slevel\s0\s(info\sframe\s$i)\r\nframe\s4\s(-1)\s->\slevel\s1\s(tst2\s11)\r\nframe\s3\s(-2)\s->\slevel\s1\s(eval\stst2\s11)\r\nframe\s2\s(-3)\s->\slevel\s1\s(eval\seval\stst2\s$x)\r\nframe\s1\s(-4)\s->\slevel\s2\s(tst\s$x)\r\n\r\nFrom\sthe\sdocumentation,\sI\sexpected\r\nframe\s5\s->\s(no\slevel)\r\nframe\s4\s->\slevel\s0\r\nframe\s3\s->\s(no\slevel)\r\nframe\s2\s->\s(no\slevel)\r\nframe\s1\s->\slevel\s-1\r\n\r\nHowever,\sif\syou\stry\sto\suse\s'uplevel'\sto\sdetermine\swhat\sthe\svalues\sof\s$i\sand\s$x\sare\sin\sthe\scommands,\sthen\sit\sturns\sout\sthe\sreturned\slevels\sare\sexactly\sright:\sadd\r\n\s\s\s\s\s\s\s\sputs\s"[uplevel\s$level\ssubst\s[list\s[dict\sget\s$frame\scmd]]]"\r\nto\sthe\sabove\sloop.\r\n\r\n-Marcel\svan\sder\sGoot
J foundin 8.6.0
J is_private 0
J login anonymous
J priority 5\sMedium
J private_contact f911612b13fc724ee2ff97acb8261b48c1b25f3c
J resolution None
J severity Important
J status Open
J submitter anonymous
J subsystem -\sNew\sBuiltin\sCommands
J title info\sframe\s'level'\sdoes\snot\smatch\sdocumentation
J type Bug
K 197e2bf85c08b9f468b764c30fab2f3c549592da
U anonymous
Z b61b67f11311c81edeb978d50f92c2b0