1eval(n) Tcl Built-In Commands eval(n)
2
3
4
5______________________________________________________________________________
6
8 eval - Evaluate a Tcl script
9
11 eval arg ?arg ...?
12_________________________________________________________________
13
14
16 Eval takes one or more arguments, which together comprise a Tcl script
17 containing one or more commands. Eval concatenates all its arguments
18 in the same fashion as the concat command, passes the concatenated
19 string to the Tcl interpreter recursively, and returns the result of
20 that evaluation (or any error generated by it). Note that the list
21 command quotes sequences of words in such a way that they are not fur‐
22 ther expanded by the eval command.
23
25 This procedure acts in a way that is analogous to the lappend command,
26 except it inserts the argument values at the start of the list in the
27 variable:
28 proc lprepend {varName args} {
29 upvar 1 $varName var
30 # Ensure that the variable exists and contains a list
31 lappend var
32 # Now we insert all the arguments in one go
33 set var [eval [list linsert $var 0] $args]
34 }
35
36
38 concatenate, evaluate, script
39
40
42 catch(n), concat(n), error(n), list(n), subst(n), tclvars(n)
43
44
45
46Tcl eval(n)