Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Resources of a namespace are still available after the namespace is deleted.

Opene593adf103ea27b765400ef588d49bb6f47ae7f0Created 9 years agoUpdated 9 years ago
Descriptionwiki2018-01-02 12:32:23
The following script does not fail:

namespace eval n1 {
    proc p1 {} {
        puts hello
    }
    namespace delete [namespace current] 
    p1
}

While this is known and documented, it's not ideal. The current behaviour is probably a concession to the subtleties of resource cleanup, particularly where object systems built on namespaces are involved.

In commit [3825265b17], namespace cleanup routines are simplified and rationalized. Once a namespace is deleted, the global namespace becomes the current namespace. A namespace is considered deleted once all traces and routines associated with the deletion are complete. Until that time, the namespace remains available and fully functional.

One effect of these changes is that in a coroutine yield and yieldto work as they normally do even after the namespace of the routine that provied level 1 for the coroutine is deleted.

The activationCount member of the Namespace structure has been deleted, since there are no longer "phantom" namespaces available at other levels whose current namespace was the deleted. Instead, the current namespace for those levels is the global namespace.

Referenced by2
  • 829ad7a459Fix for [e593adf103], resources of a namespace are still available after the namespace is deleted. Simplification of namespace deletion routines. check-in2018-01-09 17:28:29
  • 3825265b17Fix for [e593adf103], resources of a namespace are still available after the namespace is deleted. Simplification of namespace deletion routines. check-in2018-01-06 17:21:09
pooryorick Ticket [e593adf103]: 3 changes [History diff]2018-01-06 19:08:01
pooryorick Ticket [e593adf103]: 3 changes [History diff]2018-01-06 19:17:26
Log in (anonymous is fine) to add a comment.