Tcl Source Code

View Ticket
Login
Ticket UUID: 3553811
Title: New internal function: TclNewNamespaceObj
Type: RFE Created on: 2012-08-02 23:35:16
Submitter: dkf Assigned to: msofer
Subsystem: 21. [namespace] Severity:
Priority: 5 Medium Last modified: 2026-11-13 11:18:44
Status: Closed Closed by: serhiy.storchaka
Resolution: Fixed Closed on: 2026-11-13 11:18:43
Version: None
Description:
There are a few places through Tcl where the C API wants to return a namespace to the script level (as a fully-qualified name). Right now, we throw away that information and just return the string name. We also have a Tcl_ObjType for handling caching of namespace names, but it is currently only used on namesapce names that are being parsed. This should be optimizable, perhaps through a new function: Tcl_Obj *TclNewNamespaceObj(Tcl_Namespace *);

The first implementation could just create the name correctly as a string object. :-) But it should be possible to do better.
User Comments:
serhiy.storchaka added on 2026-11-13 11:18:44:

TclNewNamespaceObj was added in [56f880ad7b] (Tcl 9.0). It caches the resolved namespace in the new object and is used throughout the namespace, ensemble and TclOO code.