Forum OpenACS Development: What does tclsh do for namespace cleanup?

Posted by Andrew Piskorski on
So, naive question, but what the heck does tclsh do exactly for "namespace cleanup"? If Tcl packages are leaving all sorts of bogus state hanging around in namespace variables, what magic is tclsh invoking to automatically clean up after them?
Posted by Tom Jackson on

Andrew, I'm guessing: exit.

Tillman, I think my example solves the 'what' in a very general way. Each procedure which could be called by an application needs to make sure the variables have been initialized, which happens once per request. At the end, the callback 'reset' does more than just unset some variables. It handles all cleanup for the namespace. The namespace allows you to easily manage this process. Some namespace variables you might actually like to hang around across requests, so there is no 'blind' solution to this issue, you may not want defaults restored in every case.