Skip to content
Tcl Source Code Artifact [69fa1ebcec]
Login

Artifact [69fa1ebcec]

Artifact 69fa1ebcec8a871f44803d5fce6fb2cca16376f245222724d77fcad4e054db35:

Ticket change [69fa1ebcec] - Pending ticket [0e48e053283e6fb8|0e48e05328]: <i>Clarify that [apply] functions are cleaned up</i> plus 4 other changes by sebres on 2018-03-26 20:02:35.
D 2018-03-26T20:02:35.500
J icomment 1.\sIf\syou\smeant\sthe\sinterim\sproc\s"$name"\screated\sinside\sexample\sin\sthe\smanual\spage\s-\sit\swill\sbe\salready\sremoved.\s\r\nPossibly\syou\soverlooked\sone\sthing,\sthe\sexample\sdoes\sadditionally\s-\sthe\sclean-up\swith\s"rename\s[lindex\s[info\slevel\s0]\s0]\s{}",\swhich\sdeletes\sitself\simplicitly\sbefore\sit\sreturns\sfrom\seach\s"apply-proc".\r\n\r\n2.\sIn\spart\swhere\sthe\smanual\spage\sdescribes\sthe\ssemantics\s"with\sa\spure\sTcl\sprocedure"\sit\smeant\sjust\sreally\ssemantic\sonly\s-\sso\sit\sis\ssimilar\sas\sit\sacts\slike\sthis\sproc.\r\n\r\nSo\sif\syou\smeant\sany\sother\scase,\slike\screate\sanother\sproc\sinside...\r\nThe\scase\swhere\ssomething\sevaluable\s(inclusive\sthe\scommand\s"apply")\screates\sa\s"sub"\sproc\sinside\sof\sits\sbody,\sis\sequivalent\sto\sany\sother\sscript-level\sbodies\swhere\sproc\swill\sbe\screated\s(tcl\sdoes\snot\shave\sscope-bound\sproc's\sat\sall,\sso\snever\simplicit\sremoved).\r\n\r\nSo\sit\smeans\s-\sthe\sproc's\screated\sfrom\severywhere\sare\salways\spersistent\s(until\sremoved\susing\s`rename\s$name\s{}`.\r\nAnd\sbody\sof\sapply-lambda\sdoes\snot\sdifferent\scompared\sto\sany\sother\sevaluated\stcl-body.\r\n\r\nThis\sis\snot\sa\sleak\s(despite\sthe\sproc\sinside\swill\sbe\snormally\salways\soverwritten,\sif\ssame\sname\sused).\r\n\r\nSo\sin\sfollowing\sexample\sboth\sare\salmost\sequivalent:\r\n<pre><code>\r\nproc\stest\s{a\sb}\s{\r\n\s\sproc\slog_params\s{args}\s{puts\s"execute\s[info\slevel\s[info\slevel]]"}\r\n\s\slog_params\sa\s$a\sb\s$b\r\n}\r\ntest\sA\sB\r\n\r\nset\slambda\s{{a\sb}\s{\r\n\s\sproc\slog_params\s{args}\s{puts\s"execute\s[info\slevel\s[info\slevel]]"}\r\n\s\slog_params\sa\s$a\sb\s$b\r\n}}\r\napply\s$lambda\sA\sB\r\n</code></pre>\r\nIn\sboth\scases\sthe\sproc\sis\screated\sinside\sbody\s(note\sit's\scompiled\sonly\sonce\sbecause\sof\stcl-jit-compiler).\r\n\r\nThus\scould\syou\sexplain\sfirstly\swhich\sof\sboth\scases\sdid\syou\smeant?
J login sebres
J mimetype text/x-fossil-wiki
J resolution Invalid
J status Pending
K 0e48e053283e6fb8dcc4ecd183539ae57a31072b
U sebres
Z 6239209eb52fcb6ebf4988160794226b