TclGetNamespaceFromObj returns TCL_OK when not found
Closed / Fixed1588842fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 19 years ago
Descriptionplain2006-11-01 20:13:21
[15:04]dgpTclGetNamespaceFromObj returns TCL_OK when the namespace doesn't exist [15:04]dgpis there a (good?) reason for this? [15:06]miguelIt is doc'ed in the function header. It signals 'no prob' by TCL_OK and 'not found' by a NULL pointer. So it was designed this way ... [15:07]dgpyes, I'm questioning the wisdom of the design [15:09]dgpAs things stand, TCL_ERROR is never returned [15:09]miguelit NEVER returns anything but TCL_OK: the only possibility would be a TCL_ERROR from SetNsNameFromAny, and that one never errors either [15:09]miguelxed [15:09]dgpso the only thing that can go wrong... "no such namespace" [15:10]dgpis treated as nothing wrong to distinguish from the zero other ways things can go wrong. [15:10]dgpforcing every caller to check for NULL, and invent yet another inconsistent error message
dgp Ticket [1588842fff]: 2 changes
[History diff]2006-11-23 03:22:07
dgpplain2007-01-31 02:29:49
Logged In: YES user_id=80530 Originator: YES I think I see where this design comes from. Most callers of TclGetNamespaceFromObj() treat the non-existence of the namespace as an error. However, [namespace eval] does not. It creates the missing namespace. The design appears to be in place so that when [namespace eval] runs, Tcl doesn't generate an error message just to throw it away.
dgpplain2007-09-10 02:29:09
Logged In: YES user_id=80530 Originator: YES fixed by patch 1686862
Log in (anonymous is fine) to add a comment.