Overview
| Artifact ID: | 69fa1ebcec8a871f44803d5fce6fb2cca16376f245222724d77fcad4e054db35 |
|---|---|
| Ticket: | 0e48e053283e6fb8dcc4ecd183539ae57a31072b
Clarify that [apply] functions are cleaned up |
| User & Date: | sebres on 2018-03-26 20:02:35 |
Changes
- icomment:
1. If you meant the interim proc "$name" created inside example in the manual page - it will be already removed. Possibly you overlooked one thing, the example does additionally - the clean-up with "rename [lindex [info level 0] 0] {}", which deletes itself implicitly before it returns from each "apply-proc". 2. In part where the manual page describes the semantics "with a pure Tcl procedure" it meant just really semantic only - so it is similar as it acts like this proc. So if you meant any other case, like create another proc inside... The case where something evaluable (inclusive the command "apply") creates a "sub" proc inside of its body, is equivalent to any other script-level bodies where proc will be created (tcl does not have scope-bound proc's at all, so never implicit removed). So it means - the proc's created from everywhere are always persistent (until removed using `rename $name {}`. And body of apply-lambda does not different compared to any other evaluated tcl-body. This is not a leak (despite the proc inside will be normally always overwritten, if same name used). So in following example both are almost equivalent: <pre><code> proc test {a b} { proc log_params {args} {puts "execute [info level [info level]]"} log_params a $a b $b } test A B set lambda {{a b} { proc log_params {args} {puts "execute [info level [info level]]"} log_params a $a b $b }} apply $lambda A B </code></pre> In both cases the proc is created inside body (note it's compiled only once because of tcl-jit-compiler). Thus could you explain firstly which of both cases did you meant? - login: "sebres"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Invalid"
- status changed to: "Pending"