tabula rasa

Documentation of usage is left as an exercise to the reader.

  proc "tabula rasa" {} {
         # Still to do:  file handles (and others?), other kinds of traces,
         # namespace, global variables, procs, after queue, ...
         # The ones already here matter the most to me, though, either for
         # their hard conflicts, or potential to squander memory.


     foreach socket [file channels sock*] {
         close $socket
     }

    foreach variable [info glob] {
        foreach pair [trace info variable ::$variable] {
            foreach {op traced_command} $pair {}
            set op [string range $op 0 0]
            trace vdelete ::$variable $op $traced_command
        }
    }

    eval destroy [winfo children .]

    foreach name [image names] {
        image delete $name
    }
  }

It would be better to not mix Tcl and Tk - make seperate subprocs for tabula_rasa_tcl and tabula_rasa_tk.


DGP You are working way too hard. You can get (almost?) everything with a simple

  namespace delete ::

Tabula rasa means clean slate, not throwing away the slate entirely - davidw.

DGP Well, when "documentation is a reader exercise," I can only guess.


KPV My solution to this problem is given in "Restarting a tkcon application". It restores your wish session (not just tkcon, the title is in error) back to your initial state.


RS: When an app is in development, I frequently add a binding like this:

 bind . <Up> {exec wish $argv0 &; exit}

which restarts the app afresh from the (hopefully improved) sources. Use any keybinding you like; on bigger boxes I use <Escape>, but on the iPaq there's only <Return> and the cursor keys available.