<i>[break] should take an "after"-script</i> status still Open with 4 other changes
by
.
D 2002-05-26T01:28:12
J icomment Logged\sIn:\sNO\s\n\nAt\s2002-05-10\s14:56,\s\sdgp\swrote:\n>\sThe\sparticular\sapplications\soutlined\sin\sthe\sproposal\sare\n>\sworthwhile\sand\sinteresting,\sbut\sTcl\salready\sprovides\sthe\n>\sability\sto\sdefine\snew\slooping\scommands\sand\snew\scompletion\n>\scodes\sthat\scan\simplement\sthose\sideas.\n\nWhereas\sthis\sis\squite\strue,\sit\sis\salso\sthe\scase\sthat\sthe\nelegant\sway\sof\sdefining\sthese\scommands\sis\sfar\sfrom\sobvious,\nand\sthe\sreply\swould\shave\sbeen\smuch\smore\senlightning\sif\sit\nhad\scontained\san\sexample.\sAs\sit\swere,\sI\sstumbled\supon\s*the*\n(?\s--\sthere\scould\sbe\sothers\s...)\selegant\ssolution\sand\scould\nshare\sit\swith\sthe\sworld\son\sthe\sWiki\s(see\nhttp://mini.net/tcl/return),\sbut\sthere\swas\sa\sfair\samount\sof\nluck\sin\sthat.\n\n>\sSuch\scommands\scould\n>\sbe\sadded\sto\sthe\scontrol\spackage\sof\stcllib,\sif\sit\sis\s\n>\sbelieved\snecessary\sto\sprovide\ssuch\scommands\sbroadly.\s\sI\n>\sdon't\sthink\sthere's\sany\sneed\sto\schange\sthe\score\sto\sgive\n>\sthe\sproposer\sthe\spower\she\sseeks.\n\nI\shope\syou\swill,\sand\sI\sagree\sthe\sprogramming\sconvenience\sI\nrequested\scan\sbe\sfound\swithout\schanging\sthe\score.\sThe\sonly\nreason\sI\snow\ssee\sfor\sincorporating\sthis\sinto\sthe\score\sis\nthat\sthere\sare\smuch\smore\sefficient\sways\sof\sbytecoding\nbreak-with-eval\sthan\sthat\swhich\sthe\sbyte-compiler\sproduces\nfrom\sthe\sscript-level\ssolutions.\sI\ssuspect\sincorporation\sin\nthe\score\sis\sthe\sonly\sway\sto\smake\sthe\scompiler\sproduce\sthese\noptimal\scodings\s(but\smaybe\sTcl9\swill\shave\sinterfaces\sthat\nallow\sextensions\sto\sspecify\soptimal\sbytecode\seven\sfor\ncontrol\sstructures\ssuch\sas\sbreak-with-eval?).\s\n\n>\sI\sdo\snot\sthink\sthis\srequest\sis\sa\sgood\sidea.\s\sIt\sproposes\sa\n>\schange\sto\s[break],\sbut\sreally\sthis\sis\sa\sproposed\schange\sto\sa\n>\snumber\sof\scommands\sthat\srespond\sto\sthe\sTCL_BREAK\s\n>\scompletion\scode.\n\nI\shope\syou\sare\saware\sthat\sa\ssimilar\scritique\scould\sbe\ndirected\sagainst\sTIP#90.\sThere\s"a\snumber\sof\scommands"\s(more\nprecisely\severy\scommand\sdefined\sby\s[proc])\sare\salready\nexhibiting\sa\sspecial\sbehaviour,\sbut\sthat\sis\snot\scompletely\nsatisfactory\sand\sso\sit\sneeds\sto\sbe\schanged.\s*Note*\sthat\sI'm\nnot\ssaying\sthat\sI\swant\sto\sdirect\ssuch\scritique\sagainst\nTIP#90,\sI'm\smerely\spointing\sout\sthat\swhat\sdifference\sthere\nis\sbetween\sthe\sproposals\sis\sa\sdifference\sin\sdegree\srather\nthan\ssomething\sspecifically\sdistinict.\n\nIndeed,\sthere\sis\sa\sscript\slevel\sworkaround\sto\sthe\sreturn\n-code\sversus\scontrol::do\sproblem\sthat\sis\squite\ssimilar\sto\nthe\sscript\slevel\simplementation\sof\sbreak-with-eval.\sConsider\n\nproc\seproc\s{name\sarglist\sbody}\s{\n\s\s\s\sinterp\salias\s{}\s$name\s{}\seproc_call\s"$name\s"\n\s\s\s\sproc\s"$name\s"\s$arglist\s$body\n}\nproc\sreturneval\s{script}\s{return\s-code\s-1\s$script}\nproc\seproc_call\s{args}\s{\n\s\s\s\sset\scode\s[catch\s[list\suplevel\s1\s$args]\sres]\n\s\s\s\sif\s{$code\s==\s-1}\sthen\s{\n\s\s\s\s\s\s\s\sset\scode\s[catch\s[list\suplevel\s1\s$res]\sres]\n\s\s\s\s\s\s\s\sreturn\s-code\s$code\s$res\n\s\s\s\s}\selseif\s{$code\s==\s1}\sthen\s{\n\s\s\s\s\s\s\s\sglobal\serrorInfo\serrorCode\n\s\s\s\s\s\s\s\sreturn\s-code\serror\s-errorinfo\s$errorInfo\s-errorcode\n$errorCode\s$res\n\s\s\s\s}\selse\s{\n\s\s\s\s\s\s\s\sreturn\s-code\s$code\s$res\n\s\s\s\s}\n}\n\nWith\sthese\scommands,\sone\scan\sinstead\sof\sthe\sdefinition\n\nproc\sb\s{}\s{control::do\s{return\s-code\serror}\swhile\s1}\n\nwhich\sstumbles\son\sthe\sfact\sthat\scontrol::do\sis\sa\sproc,\suse\nthe\sdefinition\n\neproc\sc\s{}\s{control::do\s{returneval\s{error}}\swhile\s1}\n\nwhich\sdoes\snot.\sIndeed,\seven\sthe\s$errorInfo\sone\sgets\safter\n[catch\sc]\sis\s(with\sthe\sexception\sof\sthe\sproc\sname)\sidentical\nto\sthat\sone\sgets\sfrom\s[catch\sa],\swhere\s[a]\sis\sdefined\sby\n\nproc\sa\s{}\s{while\s1\s{return\s-code\serror}}\n\nIs\sit\sreasonable\sto\srequest\sthe\suse\sof\s[eproc]\srather\sthan\n[proc]?\sPerhaps\snot,\sbut\sit\sprobably\sisn't\ssubstantially\nmore\sreasonable\sto\srequest\sthe\suse\sof\s[breakeval-aware\nforeach]\sand\s[breakeval\s{script}]\sinstead\sof\s[foreach]\sand\n[break\s{script}].\n\n/Lars\sHellström\n\n
J login nobody
J mimetype text/plain
J username nobody
K 550789ffffffffffffffffffffffffffffffffff
U nobody
Z 0d77d5bc95688ce847323102c39fb2d4