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. ...

Get Practical Programming in Tcl & Tk, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.