Skip to content
Tcl Source Code Artifact [56c9c2542f]
Login

Artifact [56c9c2542f]

Artifact 56c9c2542faa5f15915725d8bc67ca34ddd93bf6:

Ticket change [56c9c2542f] - Ticket [1932618fffffffff|1932618fff] <i>Enhance [proc] for anonymous functions and closures</i> status still Open with 4 other changes by dkf on 2016-07-14 07:26:05.
D 2016-07-14T07:26:05.525
J assignee dkf
J icomment This\sis\sgenuinely\stricky\sto\sdo\swithout\sintroducing\ssome\swhopper\sincompatibilities\sat\sthe\sdeep\ssemantic\slevel.\sIn\sparticular,\s"capturing\sthe\scurrent\senvironment"\sis\sdifficult\swithout\scausing\sdeep\strouble\swith\svalues\sthat\sare\snot\sproperly\sserializable\s(unlike\s<i>all</i>\scurrent\sTcl-defined\svalues).\sThe\sproblem\sis\sthat\s<tt>proc</tt>\screates\scommands,\sand\scommand\shandles\sare\ssingle\svalues\swith\san\sexpectation\sthat\sthey\scan\sbe\sused\stransparently.\r\n\r\nHowever,\syou\scan\sdo\sa\slot\swith\s<tt>coroutine</tt>\sand\s<tt>apply</tt>\swithout\stackling\sthe\sdeeply\sdifficult\sparts.\sYou\scan\salso\sdo\sa\slot\smore\sif\syou're\screating\sa\s<tt>method</tt>\sand\snot\sa\sprocedure\scall;\sthe\sextra\scontext\s(and\sthe\sexpectation\sof\scalling\sthe\scode\svia\san\sobject\shandle)\smake\sa\sbig\sdifference.\sFinally,\syou\salso\sgain\soptions\sif\syou\sdrop\sthe\sexpectation\sof\sbeing\sable\sto\smodify\scaptured\svariables\sand\shave\sthose\smodifications\spersist.\s(There\sare\salso\sissues\srelating\sto\swhat\sthe\sexpected\scaptured\sstack\swould\slook\slike;\sI\s<i>really</i>\srecommend\snot\strying\sto\scapture\sthat\swithout\sa\s<tt>coroutine</tt>!)\sFor\sexample,\sif\syou\sdrop\sbeing\susable\sa\ssingle\svalue\sand\smodifying\sthe\scaptures,\syou\scan\sdo\sit\swith\s<tt>apply</tt>\sand\ssome\screative\sscripting.
J login dkf
J mimetype text/x-fossil-wiki
K 1932618fffffffffffffffffffffffffffffffff
U dkf
Z 788f4365f6a550fec0de6d1b07e3f218