Tcl namespace support

In the tclprocs directory there is a .upocindex file, whose header is:

#This index file is used by the GUI
#It is maintained by the mktclindex and should not be edited manually.
#Removing or editing this file will prevent the GUI from displaying
#Information properly.

#Format: { {upoc type} {procname} {filename} }

You cannot put procedure names into this file which are meant to be used only as subroutines.

Defining a Tcl namespace

There are two methods of defining a Tcl namespace and its procs.

  • Method 1: Define all procs in the namespace eval body:
    namespace eval testNS {
    proc proc1 { args } { 
    #code 
    }
    }
  • Method 2: Define procs with a qualified name and outside of the namespace eval body.
    namespace eval testNS {
    }
    Proc testNS::proc1 { args } {
    #code
    }

In the system, only procs that are defined with "Method 2" are saved into the .upocindex file and are visible on the IDE’s UPoC list. To use namespace in the script, put private procs inside the namespace eval body (Method 1). Then, define public procs with the qualified name format (Method 2).