<i>[dict for] "value" var name escapes code block scope</i> status still Open with 3 other changes
by
.
D 2024-03-18T04:47:37.365
J icomment I\sdon't\sunderstand\sthe\sbug.\sSeems\sto\sme\sexpected\sbehavior.\sWhy\swould\syou\sexpect\sh\sto\snot\sbe\sset?\sThe\sdict\sfor\sexecutes\sin\sthe\ssame\sscope\sas\sthe\scontaining\scode\sand\sintroduces\svariables\sin\sthat\sscope.\r\n\r\nWith\srespect\sto\sdifference\sin\sbehavior\sbetween\sproc\sand\sglobal\scases,\sthat\shas\snothing\sto\sdo\swith\sthe\sdict\scommand.\r\n\r\n```\r\n%\sset\sfoo\s1\r\n1\r\n%\svariable\sfoo\r\n%\sproc\sxx\s{}\s{set\sx\s1;\svariable\sx}\r\n%\sxx\r\nvariable\s"x"\salready\sexists\r\n%\snamespace\seval\sns\s{set\sz\s1;\svariable\sz}\r\n%\r\n```\r\n\r\nNote\sonly\sthe\sproc\scase\sgenerates\san\serror,\snot\sthe\sglobal\sor\snamespace\scases,\sbecause\sthe\scommand\shas\sdifferent\ssemantics\sinside\sa\sproc.\sAt\sthe\sglobal\sor\snamespace\slevel,\sthe\scommand\screates\sa\svariable.\sWithin\sa\sproc,\s`variable`\screates\sa\s*link*\sto\sthe\svariable\sof\sthat\sname\sin\sthe\scontaining\snamespace.\sLinked\svariables\sare\snot\sallowed\sif\sa\svariable\sof\sthat\sname\salready\sexists.\sYou\scan\ssee\sthis\swith\supvar\sas\swell.\r\n\r\n```\r\n%\sset\sv\s1\r\n1\r\n%\sproc\syy\s{}\s{set\sx\s1;\supvar\sv\sx}\r\n%\syy\r\nvariable\s"x"\salready\sexists\r\n```\r\n\r\nI\ssee\sthe\ssame\sbehavior\swith\sTcl\s8.6.13\son\sWindows\sas\s8.6.14.\sAs\sto\swhy\syou\sdo\snot\ssee\sthe\serror\swith\s8.6.13\son\sWine,\sno\sidea.\r\n\r\n```\r\n%\sproc\sp\s{}\s{\r\n\s\s\s\svariable\sd\s{a\s0}\r\n\s\s\s\sdict\sfor\s{key\sh}\s$d\s{}\r\n\s\s\s\svariable\sh\s"Should\snot\sbe\sset\salready"\r\n}\r\n%\sp\r\nvariable\s"h"\salready\sexists\r\n%\spackage\srequire\sTcl\r\n8.6.13\r\n```
J login apnadkarni
J mimetype text/x-markdown
K 7cea8bfad06c3f18421511d24e25cfa8a7d1fd87
U apnadkarni
Z 6ad7e0e1a7e7d07153b104b883c9db0e