Chapter 10. Quoting Issues and Eval

This chapter describes explicit calls to the interpreter with the eval command. An extra round of substitutions is performed that results in some useful effects. The chapter describes the quoting problems with eval and the ways to avoid them. The uplevel command evaluates commands in a different scope. The subst command does substitutions but no command invocation.

Dynamic evaluation makes Tcl flexible and powerful, but it can be tricky to use properly. The basic idea is that you create a string and then use the eval command to interpret that string as a command or a series of commands. Creating program code on the fly is easy with an interpreted language like Tcl, and very hard, if not impossible, with a statically ...

Get Practical Programming in Tcl and Tk, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.