Native Inspect Manual (H06.07+)
Using Tcl Scripting
Native Inspect Manual—528122-006
5-4
Namespaces and Package Loading Rules
Explicitly Export Your Public Commands: Your package should export its public
commands (but not its private commands), as follows:
namespace eval ::mySub::: {
namespace export {[a-z]*}
}
proc ::mySub::myPublicProc{} {...}
Each namespace exports symbols that can be explicitly included, and unambiguously
defined. The definition can be nested in the namespace itself (without the namespace
qualifier) or declared as a member of the namespace, with the namespace name
qualified in the proc name, as follows:
#--------------------------------------------------------
# Syntax: dcba <context> <craddr> [ <count> ]
#-------------------------------------------------------------
proc ::mySub::dcba { context craddr {count 1} } {
...
}
...
If a Tcl script is to use the commands in mySub, the caller need only reference the
package as follows:
package require mySub
Other Scripts Must Import Packages and Commands
If you have explicitly exported your public commands, another user can use a wild card
to import your public commands, as follows:
# In an app or another package
namespace eval ::mySub:: {
namespace import ::mySub::*
}
A user can invoke your help by entering the Tcl help (or tclhelp) command, as follows:
tcl help commandname










