Chapter 13. Reflection and Debugging

   

Practical Programming in Tcl & Tk, Third Edition
By Brent B. Welch

Table of Contents
Part II.  Advanced Tcl


This chapter describes commands that give you a view into the interpreter. The history command and a simple debugger are useful during development and debugging. The info command provides a variety of information about the internal state of the Tcl interpreter. The time command measures the time it takes to execute a command. Tcl commands discussed are: clock, info, history, and time.

Reflection provides feedback to a script about the internal state of the interpreter. This is useful in a variety of cases, from testing to see whether a variable exists to dumping the state of the interpreter. The info command provides lots of different information about the interpreter.

The clock command is useful for formatting dates as well as parsing date and time values. It also provides high-resolution timer information for precise measurements.

Interactive command history is the third topic of the chapter. The history facility can save you some typing if you spend a lot of time entering commands interactively.

Debugging is the last topic. The old-fashioned approach of adding puts commands to your code is often quite useful. For tough problems, however, a real debugger is invaluable. The TclPro tools from Scriptics include a high quality debugger and static code checker. The tkinspect program is an inspector that lets you look into the state of a Tk application. It can hook up to any Tk application dynamically, so it proves quite useful.


       
    Top
     



    Practical Programming in Tcl and Tk
    Practical Programming in Tcl and Tk (4th Edition)
    ISBN: 0130385603
    EAN: 2147483647
    Year: 1999
    Pages: 478

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net