www.gibmonks.com




  Previous section   Next section

Practical Programming in Tcl & Tk, Third Edition
By Brent B. Welch

Table of Contents
Chapter 14.  Namespaces


The namespace Command

Table 14-1 summarizes the namespace operations:

Table 14-1. The namespace command.
namespace currentReturns the current namespace.
namespace children ?name? ?pat?Returns names of nested namespaces. name defaults to current namespace. pat is a string match pattern that limits what is returned.
namespace code scriptGenerates a namespace inscope command that will eval script in the current namespace.
namespace delete name ?name? ...Deletes the variables and commands from the specified namespaces.
namespace eval name cmd ?args? ...Concatenates args, if present, onto cmd and evaluates it in name namespace.
namespace export ?-clear? ?pat? ?pat? ...Adds patterns to the export list for current namespace. Returns export list if no patterns.
namespace forget pat ?pat? ...Undoes the import of names matching patterns.
namespace import ?-force? pat ?pat? ...Adds the names matching the patterns to the current namespace.
namespace inscope name cmd ?args? ...Appends args, if present, onto cmd as list elements and evaluates it in name namespace.
namespace origin cmdReturns the original name of cmd.
namespace parent ?name?Returns the parent namespace of name, or of the current namespace.
namespace qualifiers nameReturns the part of name up to the last :: in it.
namespace which ?flag? nameReturns the fully qualified version of name. The flag is one of -command, -variable, or -namespace.
namespace tail nameReturns the last component of name.


      Previous section   Next section
    Top