Skip to content
Tcl Source Code Artifact [ae0e1e08a7]
Login

Artifact [ae0e1e08a7]

Artifact ae0e1e08a72fa58d7686b4cb5285c32ca1065765e782b867f88da41bc472eb97:

Ticket change [ae0e1e08a7] - New ticket [e1053b00394c6ed4|e1053b0039] <i>Need clarification on syntax ambiguity: double quotes vs command substitution</i>. by anonymous on 2025-09-09 07:15:20.
D 2025-09-09T07:15:20.391
J assignee nobody
J closer nobody
J cmimetype text/x-fossil-plain
J comment [\sMy\sapologies\sif\sthis\sis\sthe\swrong\splace\sto\sreport\sthis,\sI'm\snot\sfamiliar\swith\sthe\sTCL\sdev\sinfrastructure.\s]\r\n\r\nIn\sour\sproject\sI\swrote\sa\sTCL\sline:\r\n...\r\n\s\s\s\s\s\s\s\sverbose\s-log\s"$fmt\s[get_line_1\s$y\s""\s$attrs]"\s\r\n...\r\nand\sthere\swas\ssome\sdiscussion\son\swhether\sthis\sis\svalid\sTCL\ssyntax,\sso\sit\sgot\schanged\s(\shttps://sourceware.org/pipermail/gdb-patches/2025-July/219538.html\s)\sto:\r\n...\r\n\s\s\s\s\s\s\s\sverbose\s-log\s"$fmt\s[get_line_1\s$y\s{}\s$attrs]"\s\r\n...\r\n\r\nThe\sTCL\sinterpreter\sseems\sto\shandle\sthe\stwo\slines\sthe\ssame,\sso\sI'm\sassuming\sit's\svalid\ssyntax.\r\n\r\nRegardless,\sit's\snot\sclear\sfrom\sthe\ssyntax\sdefinition\swhether\sit's\svalid\sor\snot.\r\n\r\nThe\ssyntax\sdefinition\sstates:\r\n...\r\nIf\sthe\sfirst\scharacter\sof\sa\sword\sis\sdouble-quote\s(“"”)\sthen\sthe\sword\sis\sterminated\sby\sthe\snext\sdouble-quote\scharacter.\r\n...\r\n\r\nSo\sthe\squestion\sis,\swhat\sis\sthe\s"next\sdouble-quote\scharacter"\sin\sthis\scase.\s\sThis:\r\n...\r\n\s\s\s\s\s\s\s\sverbose\s-log\s"$fmt\s[get_line_1\s$y\s""\s$attrs]"\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s^\r\n...\r\nor\sthis:\r\n...\r\n\s\s\s\s\s\s\s\sverbose\s-log\s"$fmt\s[get_line_1\s$y\s""\s$attrs]"\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s^\r\n...\r\n?\r\n\r\nIf\sit\sis\sthe\slatter,\sthen\sthe\suse\sof\sthe\sterm\s"next\sdouble-quote\scharacter"\sis\smisleading.\r\n\r\nI\sthink\sthe\ssame\sproblem\sexists\smore\sor\sless\sfor:\r\n...\r\n\s\s\s"foo\s\\"\sbar"\r\n...\r\nbut\sin\sthis\scase\sthe\sdefinition\sof\sbackslash\ssubstitution\sexplains\sthat\s\\"\sis\streated\sas\san\sordinary\scharacter,\swhich\sexplains\swhy\s\\"\sdoesn't\sterminate\sthe\sstring.\r\n\r\nBut\sin\sthe\scase\sof\sthe\scommand\ssubstitution\sdefinition,\sthere's\sno\ssuch\sexplanation,\sthough\sone\scould\sargue\sthat\sit\scan\sbe\sinferred\sfrom\s"invokes\sthe\sTcl\sinterpreter\srecursively\sto\sprocess\sthe\scharacters\sfollowing\sthe\sopen\sbracket\sas\sa\sTcl\sscript".\s\r\n\r\nMy\sguess\sat\san\simproved\sformulation\swould\sbe\ssomething\slike:\r\n...\r\nDouble\squotes.\r\n\r\n\s\s\s\sIf\sthe\sfirst\scharacter\sof\sa\sword\sis\sdouble-quote\s(“"”)\sthen\sthe\sword\sis\sterminated\sby\sthe\snext\sdouble-quote\scharacter\s(that\sis\snot\ssubstituted\sby\sbackslash\sor\scommand\ssubstitution).\sIf\ssemi-colons,\sclose\sbrackets,\sor\swhite\sspace\scharacters\s(including\snewlines)\sappear\sbetween\sthe\squotes\sthen\sthey\sare\streated\sas\sordinary\scharacters\sand\sincluded\sin\sthe\sword.\sCommand\ssubstitution,\svariable\ssubstitution,\sand\sbackslash\ssubstitution\sare\sperformed\son\sthe\scharacters\sbetween\sthe\squotes\sas\sdescribed\sbelow.\s\sThe\sdouble-quotes\sare\snot\sretained\sas\spart\sof\sthe\sword.\s\r\n...
J is_private 0
J login anonymous
J priority 5\sMedium
J resolution None
J severity Minor
J status Open
J submitter anonymous
J subsystem None
J title Need\sclarification\son\ssyntax\sambiguity:\sdouble\squotes\svs\scommand\ssubstitution
J type Bug
K e1053b00394c6ed4bd9446e521fe17a9002a156d
U anonymous
Z c9871f9d4cbd7e69774cbc4f799cc2b5