Overview
| Artifact ID: | 041844a27e39a5550ec7f13daf869768929c5781 |
|---|---|
| Ticket: | 1655294fffffffffffffffffffffffffffffffff
command found in deleted namespace |
| User & Date: | msofer on 2007-09-10 07:22:14 |
Changes
- icomment:
Logged In: YES user_id=148712 Originator: NO Your expectations collide with what is coded, apparently by design. The namespace ::x does not die when [namespace delete ::x] returns, but rather when the last CallFrame using ::x is popped; the comments at tclNamesp.c line 588 describe that: /* * If the namespace is on the call frame stack, it is marked as "dying" * (NS_DYING is OR'd into its flags): the namespace can't be looked up * by name but its commands and variables are still usable by those * active call frames. When all active call frames referring to the * namespace have been popped from the Tcl stack, Tcl_PopCallFrame will * call this procedure again to delete everything in the namespace. * If no nsName objects refer to the namespace (i.e., if its refCount * is zero), its commands and variables are deleted and the storage for * its namespace structure is freed. Otherwise, if its refCount is * nonzero, the namespace's commands and variables are deleted but the * structure isn't freed. Instead, NS_DEAD is OR'd into the structure's * flags to allow the namespace resolution code to recognize that the * namespace is "deleted". The structure's storage is freed by * FreeNsNameInternalRep when its refCount reaches 0. */ Note that this might just be a bug in [namespace which], it seems to be otherwise respected: % namespace eval x {die; ::x::test} invalid command name "::x::test" This being said: the precise going-ons on namespace deletion, especially wrt to the interplay with active call frames and deletion traces, is not specified anywhere but in code comments. Hard to say how much is really by actual design, as opposed to a least-bad judgment at the time it was coded. - login: "msofer"
- mimetype: "text/plain"
- username: "msofer"