Error processing request

Parameters

CONTENT_LENGTH0
REQUEST_METHODGET
REQUEST_URI/revision/return?V=80
QUERY_STRINGV=80
CONTENT_TYPE
DOCUMENT_URI/revision/return
DOCUMENT_ROOT/var/www/nikit/nikit/nginx/../docroot
SCGI1
SERVER_PROTOCOLHTTP/1.1
HTTPSon
REMOTE_ADDR172.70.174.166
REMOTE_PORT25116
SERVER_PORT4443
SERVER_NAMEwiki.tcl-lang.org
HTTP_HOSTwiki.tcl-lang.org
HTTP_CONNECTIONKeep-Alive
HTTP_ACCEPT_ENCODINGgzip, br
HTTP_X_FORWARDED_FOR3.84.231.140
HTTP_CF_RAY86bdbb4fc94882c0-IAD
HTTP_X_FORWARDED_PROTOhttps
HTTP_CF_VISITOR{"scheme":"https"}
HTTP_ACCEPT*/*
HTTP_USER_AGENTclaudebot
HTTP_CF_CONNECTING_IP3.84.231.140
HTTP_CDN_LOOPcloudflare
HTTP_CF_IPCOUNTRYUS

Body


Error

Unknow state transition: LINE -> END

-code

1

-level

0

-errorstack

INNER {returnImm {Unknow state transition: LINE -> END} {}} CALL {my render_wikit return `'''\[http://www.tcl.tk/man/tcl/TclCmd/return.htm%|%return\]'''`,\ a\ \[TclCommands%|%built-in\]\ \[Tcl\]\ \[command\],\ returns\ a\ value,\ a\ code\ and\ other\nCommands%|%built-in\]\ \[Tcl\]\ \[command\],\ terminates\ a\ script,\ specifying\ its\nresult.\n\n\n**\ Synopsis\ **\n\n\n\ \ \ \ :\ \ \ `'''return'''\ ?'''-code'''\ ''code''?\ ?''result''`\n\n\ \ \ \ :\ \ \ `'''return'''\ ?''option\ value''?\ ?''result''`\n\n\n\n\n\n\n\ \ \ `'''-errorcode'''\ ''list''`:\ \ \ \n\n\n\ \ \ `'''-errorinfo'''\ ''info''`:\ \ \ \n\n\n\ \ \ `'''-errorstack'''\ ''list''`:\ \ \ added\ in\ Tcl8.6\n\n\n\ \ \ `'''-level'''\ ''level''`:\ \ \ \n\ \ \ `'''-leval'''\ ''level''`:\ \ \ \n\n\ \ \ `'''-options'''\ ''options''`:\ \ \ \n\n\n\n**\ Documentation\ **\n\n\ \ \ \[http://www.tcl.tk/man/tcl/TclCmd/return.htm%|%official\ reference\]:\ \ \ \n\ \ \ \[http://www.tcl.tk/man/tcl/TclCmd/uplevel.htm%|%official\ reference\]:\ \ \ \n\ \ \ \[TIP\]\ \[http://www.tcl.tk/cgi-bin/tct/tip/90.html%|%90\],\ \ Enable\ `return\ -code`\ in\ Control\ Structure\ Procs:\ \ \ \n\ \ \ \[TIP\]\ \[http://www.tcl.tk/cgi-bin/tct/tip/90.html%|%90\],\ \ Enable\ \[return\ -code\]\ in\ Control\ Structure\ Procs:\ \ \ \n\n\n**\ Description\ **\n\nDelivers\ a\ return\ code\ for\ some\ level\ to\ the\ interpreter,\ which\ then\ takes\ some\nReturn\ immediately\ from\ the\ current\ procedure\ or\ script,\ with\ the\ specified\nresult.\ \ The\ default\ result\ is\ the\ empty\ string.\n======\nWhen\ there\ is\ no\ `return`\ in\ a\ script,\ its\ value\ is\ the\ value\ of\ the\ last\ncommand\ evaluated\ in\ the\ script.\nThe\ return\ value\ is\ either\ the\ final\ argument\ or\ the\ \[empty\ string\].\ \ `\[catch\]`\nAny\ additional\ ''option''/''value''\ pairs\ are\ added\ to\ the\ options\ dictionary\ for\ the\ level.\ \n\n\n\n**\ Return\ Codes\ **\n**\ Exceptional\ Returns\ **\nTypically,\ `'''-code'''`\ isn't\ specified\ and\ the\ level\ returns\ a\ normally,\ i.e.\nIn\ the\ usual\ case\ where\ `'''-code'''`\ isn't\ specified,\ the\ procedure\ will\nreturn\ normally\ (its\ completion\ code\ will\ be\ `TCL_OK`).\ However,\ `-code`\ may\ be\nused\ to\ generate\ an\ exceptional\ return\ from\ the\ procedure.\ \ Code\ may\ have\ any\nof\ the\ following\ values:\ \n\ \ \ '''`0`''':\ \ \ \n\ \ \ `'''ok'''`:\ \ \ Normal\ return:\ \ same\ as\ if\ the\ option\ is\ omitted.\ \n\ \ \ '''`1`''':\ \ \ \n\ \ \ `'''error'''`:\ \ \ Error\ return:\ same\ as\ if\ \[`error`\]\ were\ used\ to\ terminate\ the\ procedure,\ except\ for\ handling\ of\ `\[errorInfo%|%\$errorInfo\]`\ and\ `\[errorCode%|%\$errorCode\]`\ (see\ below).\ \n\ \ \ '''`2`''':\ \ \ \n\ \ \ `'''return'''`:\ \ \ The\ current\ procedure\ will\ return\ with\ a\ completion\ code\ of\ `TCL_RETURN`,\ so\ that\ the\ procedure\ that\ invoked\ it\ will\ return\ also.\ \n\ \ \ '''`3`''':\ \ \ \n\ \ \ `'''break'''`:\ \ \ The\ current\ procedure\ will\ return\ with\ a\ completion\ code\ of\ `TCL_BREAK`,\ which\ will\ terminate\ the\ innermost\ nested\ loop\ in\ the\ code\ that\ invoked\ the\ current\ procedure.\ \n`-code`\ is\ rarely\ used,\ as\ commands\ such\ as\ `\[error\]`,\ `\[break\]`\ and\n\ \ \ `'''continue'''`:\ \ \ The\ current\ procedure\ will\ return\ with\ a\ completion\ code\ of\ `TCL_CONTINUE`,\ which\ will\ terminate\ the\ current\ iteration\ of\ the\ innermost\ nested\ loop\ in\ the\ code\ that\ invoked\ the\ current\ procedure.\ \n\n\ \ \ `''value''`:\ \ \ `''Value''`\ must\ be\ an\ integer\;\ \ it\ will\ be\ returned\ as\ the\ completion\ code\ for\ the\ current\ procedure.\ \n\n`-code`\ is\ rarely\ used.\ It\ is\ provided\ so\ that\ procedures\ that\nimplement\ new\ control\ structures\ can\ reflect\ exceptional\ conditions\ back\ to\ntheir\ callers.\ \nTwo\ additional\ options,\ '''`-errorinfo`'''\ and\ '''`-errorcode`''',\ may\ be\ used\ to\nprovide\ additional\ information\ during\ error\ returns.\ These\ options\ are\ ignored\nunless\ `-code`\ is\ `error`.\ \n\n'''`-errorinfo`'''\ specifies\ an\ initial\ stack\ trace\ for\n`'''-errorinfo'''`\ specifies\ an\ initial\ stack\ trace\ for\n`\[errorInfo%|%\$errorInfo\]`\ will\ include\ the\ call\ to\ the\ procedure\ and\ higher\nlevels\ on\ the\ stack\ but\ it\ will\ not\ include\ any\ information\ about\ the\ context\nof\ the\ error\ within\ the\ procedure.\ Typically\ the\ `\[info\]`\ value\ is\ supplied\nfrom\ the\ value\ left\ in\ `\[errorInfo%|%\$errorInfo\]`\ when\ `\[catch\]`\ traps\ an\ error\nwithin\ the\ procedure.\ \n\nIf\ '''`-errorcode`'''\ is\ specified,\ ''`list`''\ provides\ a\ value\ for\nIf\ `'''-errorcode'''`\ is\ specified,\ `''list''`\ provides\ a\ value\ for\ndefault\ to\ `NONE`.\ \ (from:\ \[Tcl\ Help\])\n\n\n\n\nAfter\ `return`,\ your\ script\ can\ contain\ whatever,\ for\ instance\ comments:\n\n======\nproc\ foo\ \{\}\ \{\n\ \ \ \ puts\ Foo\n\ \ \ \ return\n\ \ \ \ This\ is\ not\ Tcl\ -\ code\ after\ the\ return\ is\ never\ evaluated\ so\ \n\ \ \ \ may\ be\ \ used\ for\ commenting...\n\}\ \;#\ RS\n======\n\n\[DGP\]:\ \ In\ Tcl\ 7\ and\ in\ recent\ enough\ Tcl\ 8.5\ that\ is\ correct.\ \ In\ the\ releases\nin\ between,\ due\ to\ some\ limitations\ in\ the\ \[bytecode\]\ compiler/execution\nmachinery\ it\ could\ not\ be\ \"whatever\":\n\n\ \ \ *\ braces\ still\ needed\ to\ be\ balanced\n\ \ \ *\ Commands\ like\ `\[set\]`\ get\ byte-compiled\ early,\ so\ a\ syntax\ error\ is\ found\ if\ a\ line\ in\ that\ post-return\ comment\ starts\ with\ set\ and\ has\ more\ than\ two\ other\ words.\n\ \ \ *\ some\ commands\ like\ \[set\]\ get\ byte-compiled\ early,\ so\ a\ syntax\ error\ is\ found\ if\ a\ line\ in\ that\ post-return\ comment\ starts\ with\ set\ and\ has\ more\ than\ two\ other\ words.\n\[Joe\ English\]\ also\ disagrees\ that\ \"whatever\"\ can\ appear\ after\ `return`.\n`\[proc\]`\ interprets\ its\ third\ argument\ as\ a\ script.\ \ It's\ therefore\ unwise,\ and\none\ could\ argue\ even\ illegal,\ to\ pass\ in\ something\ that's\ not\ at\ least\nsyntactically\ valid\ as\ a\ script,\ even\ if\ you\ know\ that\ parts\ of\ it\ will\ never\nbe\ executed.\ \ By\ way\ of\ analogy:\ `\[lindex\]`\ interprets\ its\ first\ argument\ as\ a\nlist,\ so\ you'd\ better\ only\ pass\ it\ valid\ lists.\ \ In\ Tcl\ 7.6\ and\ earlier\ you\ncould\ actually\ get\ away\ with\ things\ like\n\n======\nlindex\ \"a\ b\ c\ \{bad\{list\"\ 1\n======\n\nas\ long\ as\ the\ ''examined''\ part\ of\ the\ list\ was\ syntactically\ valid.\ \ However,\nthis\ was\ more\ of\ an\ accidental\ artifact\ of\ implementation\ details\ than\ anything\nguaranteed\ by\ the\ language,\ and\ in\ fact\ this\ raises\ an\ error\ in\ more\ recent\ Tcl\nversions.\ \ Similarly,\ if\ a\ command\ expects\ a\ script,\ you'd\ better\ pass\ it\ a\nscript.\n\n\[PYK\]\ 2013-12-10:\ \ However,\ if\ `\[lindex\]`\ is\ missing\ its\ second\ value,\ the\nfirst\ value\ can\ still\ be\ any\ value,\ even\ one\ that\ isn't\ a\ valid\ \[list\].\n\n\[AMG\]:\ There's\ a\ reason\ for\ this.\ \ When\ \[\[lindex\]\]\ is\ given\ only\ one\ argument,\ it\ interprets\ that\ as\ instruction\ to\ not\ perform\ any\ list\ indexing.\ \ No\ list\ indexing\ means\ no\ requirement\ to\ be\ a\ list.\ \ It's\ that\ simple.\n\n\[jenglish\]'s\ statement\ is\ correct,\ though\ it's\ more\ philosophical\ than\ practical.\ \ If\ \[\[return\]\]\ is\ redefined,\ code\ following\ the\ \[\[return\]\]\ could\ certainly\ come\ into\ play.\ \ Or\ perhaps\ the\ code\ isn't\ being\ executed\ but\ rather\ is\ being\ analyzed\ by\ \[Nagelfar\],\ which\ will\ surely\ take\ issue\ with\ the\ invalidity\ of\ the\ code.\ \ One\ real\ possibility\ which\ would\ upset\ Tcl\ in\ any\ event\ is\ if\ the\ text\ following\ \[\[return\]\]\ contains\ mismatched\ braces.\n\nAnd\ last,\ I\ really\ ought\ to\ mention\ that\ the\ first\ time\ Tcl\ runs\ the\ proc,\ it\ tries\ to\ \[bytecode\]\ the\ whole\ thing,\ which\ means\ wasting\ time\ analyzing\ garbage.\ \ If\ there's\ any\ doubt\ about\ the\ finality\ of\ the\ \[\[return\]\]\ (e.g.\ a\ conditional\ is\ in\ play),\ the\ compiled\ proc\ will\ contain\ code\ to\ return\ any\ errors\ found\ in\ parsing.\n\n======\nproc\ moo\ \{x\}\ \{\n\ \ \ \ if\ \{\$x\}\ \{return\ 5\}\n\ \ \ \ \"invalid\"asdf\n\}\n%\ tcl::unsupported::disassemble\ proc\ moo\nByteCode\ 0x0x913eb0,\ refCt\ 1,\ epoch\ 15,\ interp\ 0x0x8c6ac0\ (epoch\ 15)\n\ \ Source\ \"\\nif\ \{\$x\}\ \{return\ 5\}\\n\\\"invalid\\\"a\"...\n\ \ Cmds\ 2,\ src\ 34,\ inst\ 26,\ litObjs\ 4,\ aux\ 0,\ stkDepth\ 2,\ code/src\ 0.00\n\ \ Proc\ 0x0x95b5e0,\ refCt\ 1,\ args\ 1,\ compiled\ locals\ 1\n\ \ \ \ \ \ slot\ 0,\ scalar,\ arg,\ \"x\"\n\ \ Commands\ 2:\n\ \ \ \ \ \ 1:\ pc\ 0-11,\ src\ 1-18\ \ \ \ \ \ \ \ 2:\ pc\ 4-6,\ src\ 10-17\n\ \ Command\ 1:\ \"if\ \{\$x\}\ \{return\ 5\}\"...\n\ \ \ \ (0)\ loadScalar1\ %v0\ \ \ \ \ \ \ \ \ #\ var\ \"x\"\n\ \ \ \ (2)\ jumpFalse1\ +7\ \ \ #\ pc\ 9\n\ \ Command\ 2:\ \"return\ 5\"...\n\ \ \ \ (4)\ push1\ 0\ \ \ \ \ \ \ \ \ #\ \"5\"\n\ \ \ \ (6)\ done\n\ \ \ \ (7)\ nop\n\ \ \ \ (8)\ nop\n\ \ \ \ (9)\ push1\ 1\ \ \ \ \ \ \ \ \ #\ \"\"\n\ \ \ \ (11)\ pop\n\ \ \ \ (12)\ push1\ 2\ \ \ \ \ \ \ \ #\ \"extra\ characters\ after\ close-quote\"\n\ \ \ \ (14)\ push1\ 3\ \ \ \ \ \ \ \ #\ \"-code\ 1\ -level\ 0\ -errorcode\ NONE\ -errori\"...\n\ \ \ \ (16)\ syntax\ +1\ 0\n\ \ \ \ (25)\ done\n======\n\n\n\nThe\ fact\ that\ `return`\ also\ terminates\ `\[source\]`\ can\ be\ used\ for\ loading\n`\[array\]`\ contents\ without\ specifying\ an\ array\ name.\ Let\ the\ file\ t.tcl\ncontain:\n\n======\nreturn\ \{\n\ \ \ \ one\ 1\n\ \ \ \ two\ 2\n\ \ \ \ three\ 3\n\}\n======\n\nThen\ you\ can\ write\ it\ like\ this:\n\n======\narray\ set\ myArrayName\ \[source\ t.tcl\]\ \;#\ RS\n======\n\n\[wdb\]:\ This\ works,\ but\ being\ a\ purist,\ I\ prefer\ this\ text\ in\ the\ file\ to\n`\[source\]`:\n\n======\nlist\ one\ 1\ two\ 2\ three\ 3\n======\n\n\[RS\]\ 2006-06-23:\ sure.\ Just\ if\ you\ have\ hundreds\ and\ thousands\ of\ array\nelements,\ with\ `\[list\]`\ you'd\ have\ to\ backslash-escape\ the\ newlines,\ while\ with\nbracing\ they\ need\ not.\n\n\[DKF\]:\ I'm\ of\ the\ kind\ of\ purist\ which\ doesn't\ insist\ on\ using\ \[list\]\ to\ indicate\ listishness\;\ that's\ an\ illusion\ and\ the\ \[list\]-compiler\ knows\ it.\n**\ Use\ in\ \[pkgIndex.tcl\]\ **\n\n\nSee\ \[package\ index\ script\ interface\ guidelines\]\ for\ another\ use\ of\ `return`\ in\n`\[source\]`'d\ scripts:\ The\ main\ use\ for\ `return`\ outside\ procedures\ is\ in\n\[pkgIndex.tcl\]:\n\n======\nif\ \{!\[package\ vsatisfies\ \[package\ provide\ Tcl\]\ 8.4\]\}\ return\n======\n\nwhich\ avoids\ presenting\ the\ package\ to\ \[interp\]s\ that\ cannot\ use\ it.\n\n\n\n**\ `return`\ -code\ error\ **\n\n\[RS\]\ 2005-08-08:\ Using\ `return\ -code\ error`\ in\ place\ of\ plain\ `\[error\]`,\nyou\ get\ a\ leaner\ error\ traceback\ which\ is\ possibly\ better\ to\ read:\n\n======none\n%\ proc\ 1\ x\ \{if\ \{\$x<=0\}\ \{error\ \ \ \ \ \ \ \ \ \ \ \ \ \ \"too\ small\"\}\}\n\n%\ proc\ 2\ x\ \{if\ \{\$x<=0\}\ \{return\ -code\ error\ \"too\ small\"\}\}\n\n%\ 1\ 0\ntoo\ small\n%\ set\ errorInfo\ntoo\ small\n\ \ \ while\ executing\n\"error\ \"too\ small\"\"\n\ \ \ (procedure\ \"1\"\ line\ 1)\n\ \ \ invoked\ from\ within\n\"1\ 0\"\n\n%\ 2\ 0\ntoo\ small\n%\ set\ errorInfo\ntoo\ small\n\ \ \ while\ executing\n\"2\ 0\"\n======\n\n\[DKF\]:\ I\ find\ this\ is\ useful\ when\ distinguishing\ between\ problems\ with\ the\ values\ passed\ in\ by\ the\ caller\ (such\ as\ if\ the\ code\ really\ wants\ a\ string\ of\ length\ 37,\ has\ documented\ this,\ and\ yet\ the\ user\ has\ given\ a\ string\ of\ length\ 28),\ and\ problems\ internal\ to\ the\ code\ that\ it\ isn't\ reasonable\ for\ the\ caller\ to\ try\ to\ get\ right.\n**\ `return`\ to\ the\ Current\ Level\ **\n\n\n\[AMG\]\ \[PYK\]:\ `return\ -level\ 0\ \$x`\ simply\ sets\ the\ interpreter\ result\ to\ `\$x`.\ \ This\ is\ the\ canonical\ \[identity\ function\]\;\ see\ the\ linked\ page\ for\ more\ information.\n\n\n\n**\ Cancel\ an\ Error\ **\n\n\[HaO\]:\ When\ a\ return\ code\ should\ be\ forwarded\ to\ the\ caller,\ one\ could\ remove\nthe\ `level\ 0`\ to\ not\ directly\ trigger\ an\ eventual\ exception\ here:\n\n======\nif\ \{\[catch\ \{script\ goes\ here\}\ err\ options\]\}\ \{\n\ \ \ \ dict\ unset\ options\ -level\n\ \ \ \ return\ -options\ \$options\n\}\n======\n\nThis\ was\ useful\ to\ me\ in\ the\ context\ of\ \[Tk\]\ `\[bind\]`\ scripts,\ which\ return\ `break`\ if\nno\ further\ bind\ scripts\ should\ process.\n\n\n\n**\ `return`\ vs\ falling\ off\ the\ end\ of\ the\ proc\ **\n\n\ \ \ `\[source\]`:\ \ \ \n\n\ \ \ `\[eval\]`:\ \ \ \n\n\ \ \ `\[proc\]`:\ \ \ \n\n\ \ \ `\[uplevel\]`:\ \ \ includes\ a\ TclChat\ discussion\ on\ the\ future\ of\ `return`\n\n\ \ \ `\[break\]`:\ \ \ \n\n\ \ \ `\[continue\]`:\ \ \ \n\n\ \ \ `\[error\]`:\ \ \ \n\n\ \ \ `\[throw\]`:\ \ \ \n\n\ \ \ `\[yield\]`:\ \ \ \n\n\ \ \ `\[yieldm\]`:\ \ \ \n\n\ \ \ `\[yieldTo\]`:\ \ \ \n\n`\[tailcall\]`\ is\ also\ related\ to\ `return`\ in\ that\ it\ terminates\ execution\ of\ the\ncurrent\ `\[proc\]`.\ \ However,\ unlike\ `return`,\ `\[tailcall\]`'s\ \[continuation\]\ is\ not\nthe\ caller.\ \ `\[yieldTo\]`\ is\ also\ related\ to\ `\[tailcall\]`\ in\ that\ it\ has\ a\ncustom\ continuation.\n\n\n\n**\ See\ Also\ **\n\n\ \ \ \[Errors\ management\]:\ \ \ \n\n\ \ \ \[namespace\ eval\]:\ \ \ \n\ \ \ \[Script\ termination:\ results\ and\ control\]:\ \ \ \n\n\n\ \ \ \[Funky\ Tcl\ extensibility\]:\ \ \ tricks\ to\ play\ with\ `return\ -code\ return`\ and\ `\[error\]`\ on\ `return\ -code\ error`\n\n\ \ \ \[try\ ...\ finally\ ...\]:\ \ \ \ \[KBK\]\ 2001-01-02:\ how\ to\ use\ `return\ -code`\ to\ implement\ a\ new\ control\ structure.\ \[Lars\ H\]:\ Other\ pages\ which\ do\ that\ kind\ of\ thing\ are\ `\[breakeval\]`\ (using\ `-code\ 10`)\ and\ `\[returneval\]`\ (using\ `-code\ -1`).\n\n\ \ \ \[syntax\]:\ \ \ \n\n\n\n<<categories>>\ Command\ |\ Control\ Structure\ |\ Arts\ and\ crafts\ of\ Tcl-Tk\ programming regexp2} CALL {my render return `'''\[http://www.tcl.tk/man/tcl/TclCmd/return.htm%|%return\]'''`,\ a\ \[TclCommands%|%built-in\]\ \[Tcl\]\ \[command\],\ returns\ a\ value,\ a\ code\ and\ other\nCommands%|%built-in\]\ \[Tcl\]\ \[command\],\ terminates\ a\ script,\ specifying\ its\nresult.\n\n\n**\ Synopsis\ **\n\n\n\ \ \ \ :\ \ \ `'''return'''\ ?'''-code'''\ ''code''?\ ?''result''`\n\n\ \ \ \ :\ \ \ `'''return'''\ ?''option\ value''?\ ?''result''`\n\n\n\n\n\n\n\ \ \ `'''-errorcode'''\ ''list''`:\ \ \ \n\n\n\ \ \ `'''-errorinfo'''\ ''info''`:\ \ \ \n\n\n\ \ \ `'''-errorstack'''\ ''list''`:\ \ \ added\ in\ Tcl8.6\n\n\n\ \ \ `'''-level'''\ ''level''`:\ \ \ \n\ \ \ `'''-leval'''\ ''level''`:\ \ \ \n\n\ \ \ `'''-options'''\ ''options''`:\ \ \ \n\n\n\n**\ Documentation\ **\n\n\ \ \ \[http://www.tcl.tk/man/tcl/TclCmd/return.htm%|%official\ reference\]:\ \ \ \n\ \ \ \[http://www.tcl.tk/man/tcl/TclCmd/uplevel.htm%|%official\ reference\]:\ \ \ \n\ \ \ \[TIP\]\ \[http://www.tcl.tk/cgi-bin/tct/tip/90.html%|%90\],\ \ Enable\ `return\ -code`\ in\ Control\ Structure\ Procs:\ \ \ \n\ \ \ \[TIP\]\ \[http://www.tcl.tk/cgi-bin/tct/tip/90.html%|%90\],\ \ Enable\ \[return\ -code\]\ in\ Control\ Structure\ Procs:\ \ \ \n\n\n**\ Description\ **\n\nDelivers\ a\ return\ code\ for\ some\ level\ to\ the\ interpreter,\ which\ then\ takes\ some\nReturn\ immediately\ from\ the\ current\ procedure\ or\ script,\ with\ the\ specified\nresult.\ \ The\ default\ result\ is\ the\ empty\ string.\n======\nWhen\ there\ is\ no\ `return`\ in\ a\ script,\ its\ value\ is\ the\ value\ of\ the\ last\ncommand\ evaluated\ in\ the\ script.\nThe\ return\ value\ is\ either\ the\ final\ argument\ or\ the\ \[empty\ string\].\ \ `\[catch\]`\nAny\ additional\ ''option''/''value''\ pairs\ are\ added\ to\ the\ options\ dictionary\ for\ the\ level.\ \n\n\n\n**\ Return\ Codes\ **\n**\ Exceptional\ Returns\ **\nTypically,\ `'''-code'''`\ isn't\ specified\ and\ the\ level\ returns\ a\ normally,\ i.e.\nIn\ the\ usual\ case\ where\ `'''-code'''`\ isn't\ specified,\ the\ procedure\ will\nreturn\ normally\ (its\ completion\ code\ will\ be\ `TCL_OK`).\ However,\ `-code`\ may\ be\nused\ to\ generate\ an\ exceptional\ return\ from\ the\ procedure.\ \ Code\ may\ have\ any\nof\ the\ following\ values:\ \n\ \ \ '''`0`''':\ \ \ \n\ \ \ `'''ok'''`:\ \ \ Normal\ return:\ \ same\ as\ if\ the\ option\ is\ omitted.\ \n\ \ \ '''`1`''':\ \ \ \n\ \ \ `'''error'''`:\ \ \ Error\ return:\ same\ as\ if\ \[`error`\]\ were\ used\ to\ terminate\ the\ procedure,\ except\ for\ handling\ of\ `\[errorInfo%|%\$errorInfo\]`\ and\ `\[errorCode%|%\$errorCode\]`\ (see\ below).\ \n\ \ \ '''`2`''':\ \ \ \n\ \ \ `'''return'''`:\ \ \ The\ current\ procedure\ will\ return\ with\ a\ completion\ code\ of\ `TCL_RETURN`,\ so\ that\ the\ procedure\ that\ invoked\ it\ will\ return\ also.\ \n\ \ \ '''`3`''':\ \ \ \n\ \ \ `'''break'''`:\ \ \ The\ current\ procedure\ will\ return\ with\ a\ completion\ code\ of\ `TCL_BREAK`,\ which\ will\ terminate\ the\ innermost\ nested\ loop\ in\ the\ code\ that\ invoked\ the\ current\ procedure.\ \n`-code`\ is\ rarely\ used,\ as\ commands\ such\ as\ `\[error\]`,\ `\[break\]`\ and\n\ \ \ `'''continue'''`:\ \ \ The\ current\ procedure\ will\ return\ with\ a\ completion\ code\ of\ `TCL_CONTINUE`,\ which\ will\ terminate\ the\ current\ iteration\ of\ the\ innermost\ nested\ loop\ in\ the\ code\ that\ invoked\ the\ current\ procedure.\ \n\n\ \ \ `''value''`:\ \ \ `''Value''`\ must\ be\ an\ integer\;\ \ it\ will\ be\ returned\ as\ the\ completion\ code\ for\ the\ current\ procedure.\ \n\n`-code`\ is\ rarely\ used.\ It\ is\ provided\ so\ that\ procedures\ that\nimplement\ new\ control\ structures\ can\ reflect\ exceptional\ conditions\ back\ to\ntheir\ callers.\ \nTwo\ additional\ options,\ '''`-errorinfo`'''\ and\ '''`-errorcode`''',\ may\ be\ used\ to\nprovide\ additional\ information\ during\ error\ returns.\ These\ options\ are\ ignored\nunless\ `-code`\ is\ `error`.\ \n\n'''`-errorinfo`'''\ specifies\ an\ initial\ stack\ trace\ for\n`'''-errorinfo'''`\ specifies\ an\ initial\ stack\ trace\ for\n`\[errorInfo%|%\$errorInfo\]`\ will\ include\ the\ call\ to\ the\ procedure\ and\ higher\nlevels\ on\ the\ stack\ but\ it\ will\ not\ include\ any\ information\ about\ the\ context\nof\ the\ error\ within\ the\ procedure.\ Typically\ the\ `\[info\]`\ value\ is\ supplied\nfrom\ the\ value\ left\ in\ `\[errorInfo%|%\$errorInfo\]`\ when\ `\[catch\]`\ traps\ an\ error\nwithin\ the\ procedure.\ \n\nIf\ '''`-errorcode`'''\ is\ specified,\ ''`list`''\ provides\ a\ value\ for\nIf\ `'''-errorcode'''`\ is\ specified,\ `''list''`\ provides\ a\ value\ for\ndefault\ to\ `NONE`.\ \ (from:\ \[Tcl\ Help\])\n\n\n\n\nAfter\ `return`,\ your\ script\ can\ contain\ whatever,\ for\ instance\ comments:\n\n======\nproc\ foo\ \{\}\ \{\n\ \ \ \ puts\ Foo\n\ \ \ \ return\n\ \ \ \ This\ is\ not\ Tcl\ -\ code\ after\ the\ return\ is\ never\ evaluated\ so\ \n\ \ \ \ may\ be\ \ used\ for\ commenting...\n\}\ \;#\ RS\n======\n\n\[DGP\]:\ \ In\ Tcl\ 7\ and\ in\ recent\ enough\ Tcl\ 8.5\ that\ is\ correct.\ \ In\ the\ releases\nin\ between,\ due\ to\ some\ limitations\ in\ the\ \[bytecode\]\ compiler/execution\nmachinery\ it\ could\ not\ be\ \"whatever\":\n\n\ \ \ *\ braces\ still\ needed\ to\ be\ balanced\n\ \ \ *\ Commands\ like\ `\[set\]`\ get\ byte-compiled\ early,\ so\ a\ syntax\ error\ is\ found\ if\ a\ line\ in\ that\ post-return\ comment\ starts\ with\ set\ and\ has\ more\ than\ two\ other\ words.\n\ \ \ *\ some\ commands\ like\ \[set\]\ get\ byte-compiled\ early,\ so\ a\ syntax\ error\ is\ found\ if\ a\ line\ in\ that\ post-return\ comment\ starts\ with\ set\ and\ has\ more\ than\ two\ other\ words.\n\[Joe\ English\]\ also\ disagrees\ that\ \"whatever\"\ can\ appear\ after\ `return`.\n`\[proc\]`\ interprets\ its\ third\ argument\ as\ a\ script.\ \ It's\ therefore\ unwise,\ and\none\ could\ argue\ even\ illegal,\ to\ pass\ in\ something\ that's\ not\ at\ least\nsyntactically\ valid\ as\ a\ script,\ even\ if\ you\ know\ that\ parts\ of\ it\ will\ never\nbe\ executed.\ \ By\ way\ of\ analogy:\ `\[lindex\]`\ interprets\ its\ first\ argument\ as\ a\nlist,\ so\ you'd\ better\ only\ pass\ it\ valid\ lists.\ \ In\ Tcl\ 7.6\ and\ earlier\ you\ncould\ actually\ get\ away\ with\ things\ like\n\n======\nlindex\ \"a\ b\ c\ \{bad\{list\"\ 1\n======\n\nas\ long\ as\ the\ ''examined''\ part\ of\ the\ list\ was\ syntactically\ valid.\ \ However,\nthis\ was\ more\ of\ an\ accidental\ artifact\ of\ implementation\ details\ than\ anything\nguaranteed\ by\ the\ language,\ and\ in\ fact\ this\ raises\ an\ error\ in\ more\ recent\ Tcl\nversions.\ \ Similarly,\ if\ a\ command\ expects\ a\ script,\ you'd\ better\ pass\ it\ a\nscript.\n\n\[PYK\]\ 2013-12-10:\ \ However,\ if\ `\[lindex\]`\ is\ missing\ its\ second\ value,\ the\nfirst\ value\ can\ still\ be\ any\ value,\ even\ one\ that\ isn't\ a\ valid\ \[list\].\n\n\[AMG\]:\ There's\ a\ reason\ for\ this.\ \ When\ \[\[lindex\]\]\ is\ given\ only\ one\ argument,\ it\ interprets\ that\ as\ instruction\ to\ not\ perform\ any\ list\ indexing.\ \ No\ list\ indexing\ means\ no\ requirement\ to\ be\ a\ list.\ \ It's\ that\ simple.\n\n\[jenglish\]'s\ statement\ is\ correct,\ though\ it's\ more\ philosophical\ than\ practical.\ \ If\ \[\[return\]\]\ is\ redefined,\ code\ following\ the\ \[\[return\]\]\ could\ certainly\ come\ into\ play.\ \ Or\ perhaps\ the\ code\ isn't\ being\ executed\ but\ rather\ is\ being\ analyzed\ by\ \[Nagelfar\],\ which\ will\ surely\ take\ issue\ with\ the\ invalidity\ of\ the\ code.\ \ One\ real\ possibility\ which\ would\ upset\ Tcl\ in\ any\ event\ is\ if\ the\ text\ following\ \[\[return\]\]\ contains\ mismatched\ braces.\n\nAnd\ last,\ I\ really\ ought\ to\ mention\ that\ the\ first\ time\ Tcl\ runs\ the\ proc,\ it\ tries\ to\ \[bytecode\]\ the\ whole\ thing,\ which\ means\ wasting\ time\ analyzing\ garbage.\ \ If\ there's\ any\ doubt\ about\ the\ finality\ of\ the\ \[\[return\]\]\ (e.g.\ a\ conditional\ is\ in\ play),\ the\ compiled\ proc\ will\ contain\ code\ to\ return\ any\ errors\ found\ in\ parsing.\n\n======\nproc\ moo\ \{x\}\ \{\n\ \ \ \ if\ \{\$x\}\ \{return\ 5\}\n\ \ \ \ \"invalid\"asdf\n\}\n%\ tcl::unsupported::disassemble\ proc\ moo\nByteCode\ 0x0x913eb0,\ refCt\ 1,\ epoch\ 15,\ interp\ 0x0x8c6ac0\ (epoch\ 15)\n\ \ Source\ \"\\nif\ \{\$x\}\ \{return\ 5\}\\n\\\"invalid\\\"a\"...\n\ \ Cmds\ 2,\ src\ 34,\ inst\ 26,\ litObjs\ 4,\ aux\ 0,\ stkDepth\ 2,\ code/src\ 0.00\n\ \ Proc\ 0x0x95b5e0,\ refCt\ 1,\ args\ 1,\ compiled\ locals\ 1\n\ \ \ \ \ \ slot\ 0,\ scalar,\ arg,\ \"x\"\n\ \ Commands\ 2:\n\ \ \ \ \ \ 1:\ pc\ 0-11,\ src\ 1-18\ \ \ \ \ \ \ \ 2:\ pc\ 4-6,\ src\ 10-17\n\ \ Command\ 1:\ \"if\ \{\$x\}\ \{return\ 5\}\"...\n\ \ \ \ (0)\ loadScalar1\ %v0\ \ \ \ \ \ \ \ \ #\ var\ \"x\"\n\ \ \ \ (2)\ jumpFalse1\ +7\ \ \ #\ pc\ 9\n\ \ Command\ 2:\ \"return\ 5\"...\n\ \ \ \ (4)\ push1\ 0\ \ \ \ \ \ \ \ \ #\ \"5\"\n\ \ \ \ (6)\ done\n\ \ \ \ (7)\ nop\n\ \ \ \ (8)\ nop\n\ \ \ \ (9)\ push1\ 1\ \ \ \ \ \ \ \ \ #\ \"\"\n\ \ \ \ (11)\ pop\n\ \ \ \ (12)\ push1\ 2\ \ \ \ \ \ \ \ #\ \"extra\ characters\ after\ close-quote\"\n\ \ \ \ (14)\ push1\ 3\ \ \ \ \ \ \ \ #\ \"-code\ 1\ -level\ 0\ -errorcode\ NONE\ -errori\"...\n\ \ \ \ (16)\ syntax\ +1\ 0\n\ \ \ \ (25)\ done\n======\n\n\n\nThe\ fact\ that\ `return`\ also\ terminates\ `\[source\]`\ can\ be\ used\ for\ loading\n`\[array\]`\ contents\ without\ specifying\ an\ array\ name.\ Let\ the\ file\ t.tcl\ncontain:\n\n======\nreturn\ \{\n\ \ \ \ one\ 1\n\ \ \ \ two\ 2\n\ \ \ \ three\ 3\n\}\n======\n\nThen\ you\ can\ write\ it\ like\ this:\n\n======\narray\ set\ myArrayName\ \[source\ t.tcl\]\ \;#\ RS\n======\n\n\[wdb\]:\ This\ works,\ but\ being\ a\ purist,\ I\ prefer\ this\ text\ in\ the\ file\ to\n`\[source\]`:\n\n======\nlist\ one\ 1\ two\ 2\ three\ 3\n======\n\n\[RS\]\ 2006-06-23:\ sure.\ Just\ if\ you\ have\ hundreds\ and\ thousands\ of\ array\nelements,\ with\ `\[list\]`\ you'd\ have\ to\ backslash-escape\ the\ newlines,\ while\ with\nbracing\ they\ need\ not.\n\n\[DKF\]:\ I'm\ of\ the\ kind\ of\ purist\ which\ doesn't\ insist\ on\ using\ \[list\]\ to\ indicate\ listishness\;\ that's\ an\ illusion\ and\ the\ \[list\]-compiler\ knows\ it.\n**\ Use\ in\ \[pkgIndex.tcl\]\ **\n\n\nSee\ \[package\ index\ script\ interface\ guidelines\]\ for\ another\ use\ of\ `return`\ in\n`\[source\]`'d\ scripts:\ The\ main\ use\ for\ `return`\ outside\ procedures\ is\ in\n\[pkgIndex.tcl\]:\n\n======\nif\ \{!\[package\ vsatisfies\ \[package\ provide\ Tcl\]\ 8.4\]\}\ return\n======\n\nwhich\ avoids\ presenting\ the\ package\ to\ \[interp\]s\ that\ cannot\ use\ it.\n\n\n\n**\ `return`\ -code\ error\ **\n\n\[RS\]\ 2005-08-08:\ Using\ `return\ -code\ error`\ in\ place\ of\ plain\ `\[error\]`,\nyou\ get\ a\ leaner\ error\ traceback\ which\ is\ possibly\ better\ to\ read:\n\n======none\n%\ proc\ 1\ x\ \{if\ \{\$x<=0\}\ \{error\ \ \ \ \ \ \ \ \ \ \ \ \ \ \"too\ small\"\}\}\n\n%\ proc\ 2\ x\ \{if\ \{\$x<=0\}\ \{return\ -code\ error\ \"too\ small\"\}\}\n\n%\ 1\ 0\ntoo\ small\n%\ set\ errorInfo\ntoo\ small\n\ \ \ while\ executing\n\"error\ \"too\ small\"\"\n\ \ \ (procedure\ \"1\"\ line\ 1)\n\ \ \ invoked\ from\ within\n\"1\ 0\"\n\n%\ 2\ 0\ntoo\ small\n%\ set\ errorInfo\ntoo\ small\n\ \ \ while\ executing\n\"2\ 0\"\n======\n\n\[DKF\]:\ I\ find\ this\ is\ useful\ when\ distinguishing\ between\ problems\ with\ the\ values\ passed\ in\ by\ the\ caller\ (such\ as\ if\ the\ code\ really\ wants\ a\ string\ of\ length\ 37,\ has\ documented\ this,\ and\ yet\ the\ user\ has\ given\ a\ string\ of\ length\ 28),\ and\ problems\ internal\ to\ the\ code\ that\ it\ isn't\ reasonable\ for\ the\ caller\ to\ try\ to\ get\ right.\n**\ `return`\ to\ the\ Current\ Level\ **\n\n\n\[AMG\]\ \[PYK\]:\ `return\ -level\ 0\ \$x`\ simply\ sets\ the\ interpreter\ result\ to\ `\$x`.\ \ This\ is\ the\ canonical\ \[identity\ function\]\;\ see\ the\ linked\ page\ for\ more\ information.\n\n\n\n**\ Cancel\ an\ Error\ **\n\n\[HaO\]:\ When\ a\ return\ code\ should\ be\ forwarded\ to\ the\ caller,\ one\ could\ remove\nthe\ `level\ 0`\ to\ not\ directly\ trigger\ an\ eventual\ exception\ here:\n\n======\nif\ \{\[catch\ \{script\ goes\ here\}\ err\ options\]\}\ \{\n\ \ \ \ dict\ unset\ options\ -level\n\ \ \ \ return\ -options\ \$options\n\}\n======\n\nThis\ was\ useful\ to\ me\ in\ the\ context\ of\ \[Tk\]\ `\[bind\]`\ scripts,\ which\ return\ `break`\ if\nno\ further\ bind\ scripts\ should\ process.\n\n\n\n**\ `return`\ vs\ falling\ off\ the\ end\ of\ the\ proc\ **\n\n\ \ \ `\[source\]`:\ \ \ \n\n\ \ \ `\[eval\]`:\ \ \ \n\n\ \ \ `\[proc\]`:\ \ \ \n\n\ \ \ `\[uplevel\]`:\ \ \ includes\ a\ TclChat\ discussion\ on\ the\ future\ of\ `return`\n\n\ \ \ `\[break\]`:\ \ \ \n\n\ \ \ `\[continue\]`:\ \ \ \n\n\ \ \ `\[error\]`:\ \ \ \n\n\ \ \ `\[throw\]`:\ \ \ \n\n\ \ \ `\[yield\]`:\ \ \ \n\n\ \ \ `\[yieldm\]`:\ \ \ \n\n\ \ \ `\[yieldTo\]`:\ \ \ \n\n`\[tailcall\]`\ is\ also\ related\ to\ `return`\ in\ that\ it\ terminates\ execution\ of\ the\ncurrent\ `\[proc\]`.\ \ However,\ unlike\ `return`,\ `\[tailcall\]`'s\ \[continuation\]\ is\ not\nthe\ caller.\ \ `\[yieldTo\]`\ is\ also\ related\ to\ `\[tailcall\]`\ in\ that\ it\ has\ a\ncustom\ continuation.\n\n\n\n**\ See\ Also\ **\n\n\ \ \ \[Errors\ management\]:\ \ \ \n\n\ \ \ \[namespace\ eval\]:\ \ \ \n\ \ \ \[Script\ termination:\ results\ and\ control\]:\ \ \ \n\n\n\ \ \ \[Funky\ Tcl\ extensibility\]:\ \ \ tricks\ to\ play\ with\ `return\ -code\ return`\ and\ `\[error\]`\ on\ `return\ -code\ error`\n\n\ \ \ \[try\ ...\ finally\ ...\]:\ \ \ \ \[KBK\]\ 2001-01-02:\ how\ to\ use\ `return\ -code`\ to\ implement\ a\ new\ control\ structure.\ \[Lars\ H\]:\ Other\ pages\ which\ do\ that\ kind\ of\ thing\ are\ `\[breakeval\]`\ (using\ `-code\ 10`)\ and\ `\[returneval\]`\ (using\ `-code\ -1`).\n\n\ \ \ \[syntax\]:\ \ \ \n\n\n\n<<categories>>\ Command\ |\ Control\ Structure\ |\ Arts\ and\ crafts\ of\ Tcl-Tk\ programming} CALL {my revision return} CALL {::oo::Obj1251785 process revision/return} CALL {::oo::Obj1251783 process}

-errorcode

NONE

-errorinfo

Unknow state transition: LINE -> END
    while executing
"error $msg"
    (class "::Wiki" method "render_wikit" line 6)
    invoked from within
"my render_$default_markup $N $C $mkup_rendering_engine"
    (class "::Wiki" method "render" line 8)
    invoked from within
"my render $name $C"
    (class "::Wiki" method "revision" line 31)
    invoked from within
"my revision $page"
    (class "::Wiki" method "process" line 56)
    invoked from within
"$server process [string trim $uri /]"

-errorline

4