diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2008-03-06 22:08:26 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2008-03-06 22:08:26 (GMT) |
commit | b6ad23cfdff774c37a526761e6d677cd4108b2fc (patch) | |
tree | ca9af890b71bc69f626fa4ef077ffde71eb2a00e /doc | |
parent | 2022ffbe107b1d314df5ef2b4191975d8c263c8f (diff) | |
download | tcl-b6ad23cfdff774c37a526761e6d677cd4108b2fc.zip tcl-b6ad23cfdff774c37a526761e6d677cd4108b2fc.tar.gz tcl-b6ad23cfdff774c37a526761e6d677cd4108b2fc.tar.bz2 |
Minor tidying up. [Bug 1909019]
Diffstat (limited to 'doc')
-rw-r--r-- | doc/namespace.n | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/doc/namespace.n b/doc/namespace.n index e02709e..e4d3d6d 100644 --- a/doc/namespace.n +++ b/doc/namespace.n @@ -6,9 +6,9 @@ '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -'\" RCS: @(#) $Id: namespace.n,v 1.29 2007/12/13 15:22:32 dgp Exp $ -'\" +'\" +'\" RCS: @(#) $Id: namespace.n,v 1.30 2008/03/06 22:08:26 dkf Exp $ +'\" .so man.macros .TH namespace n 8.5 Tcl "Tcl Built-In Commands" .BS @@ -16,7 +16,7 @@ .SH NAME namespace \- create and manipulate contexts for commands and variables .SH SYNOPSIS -\fBnamespace \fR?\fIoption\fR? ?\fIarg ...\fR? +\fBnamespace \fR?\fIsubcommand\fR? ?\fIarg ...\fR? .BE .SH DESCRIPTION .PP @@ -24,8 +24,8 @@ The \fBnamespace\fR command lets you create, access, and destroy separate contexts for commands and variables. See the section \fBWHAT IS A NAMESPACE?\fR below for a brief overview of namespaces. -The legal values of \fIoption\fR are listed below. -Note that you can abbreviate the \fIoption\fRs. +The legal values of \fIsubcommand\fR are listed below. +Note that you can abbreviate the \fIsubcommand\fRs. .TP \fBnamespace children \fR?\fInamespace\fR? ?\fIpattern\fR? Returns a list of all child namespaces that belong to the @@ -88,7 +88,7 @@ looking it up by name. If a namespace does not exist, this command returns an error. If no namespace names are given, this command does nothing. .TP -\fBnamespace ensemble\fR \fIoption\fR ?\fIarg ...\fR? +\fBnamespace ensemble\fR \fIsubcommand\fR ?\fIarg ...\fR? .VS 8.5 Creates and manipulates a command that is formed out of an ensemble of subcommands. See the section \fBENSEMBLES\fR below for further @@ -140,19 +140,22 @@ Each \fIpattern\fR is a simple or qualified name such as \fBx\fR, \fBfoo::x\fR or \fBa::b::p*\fR. Qualified names contain double colons (\fB::\fR) and qualify a name with the name of one or more namespaces. -Each \fIqualified pattern\fR is qualified with the name of an -exporting namespace +Each +.QW "qualified pattern" +is qualified with the name of an exporting namespace and may have glob-style special characters in the command name at the end of the qualified name. Glob characters may not appear in a namespace name. -For each \fIsimple pattern\fR this command deletes the matching -commands of the +For each +.QW "simple pattern" +this command deletes the matching commands of the current namespace that were imported from a different namespace. -For \fIqualified patterns\fR, this command first finds the matching -exported commands. +For +.QW "qualified patterns" , +this command first finds the matching exported commands. It then checks whether any of those commands were previously imported by the current namespace. -If so, this command deletes the corresponding imported commands. +If so, this command deletes the corresponding imported commands. In effect, this un-does the action of a \fBnamespace import\fR command. .TP \fBnamespace import \fR?\fB\-force\fR? ?\fIpattern\fR \fIpattern ...\fR? @@ -270,20 +273,20 @@ the names of currently defined namespaces. This command arranges for one or more local variables in the current procedure to refer to variables in \fInamespace\fR. The namespace name is resolved as described in section \fBNAME RESOLUTION\fR. -The command +The command \fBnamespace upvar $ns a b\fR has the same behaviour as \fBupvar 0 $ns::a b\fR, with the sole exception of the resolution rules -used for qualified namespace or variable names. +used for qualified namespace or variable names. \fBnamespace upvar\fR returns an empty string. .TP \fBnamespace unknown\fR ?\fIscript\fR? Sets or returns the unknown command handler for the current namespace. The handler is invoked when a command called from within the namespace -cannot be found (in either the current namespace or the global namespace). +cannot be found (in either the current namespace or the global namespace). The \fIscript\fR argument, if given, should be a well formed list representing a command name and optional arguments. When the handler is invoked, the full invocation line will be appended to the -script and the result evaluated in the context of the namespace. The +script and the result evaluated in the context of the namespace. The default handler for all namespaces is \fB::unknown\fR. If no argument is given, it returns the handler for the current namespace. .TP @@ -296,7 +299,7 @@ this command returns a fully-qualified name in the global namespace. If the command or variable does not exist, this command returns an empty string. If the variable has been created but not defined, such as with the \fBvariable\fR command -or through a \fBtrace\fR on the variable, this command will return the +or through a \fBtrace\fR on the variable, this command will return the fully-qualified name of the variable. If no flag is given, \fIname\fR is treated as a command name. See the section \fBNAME RESOLUTION\fR below for an explanation of @@ -437,7 +440,7 @@ If you provide a fully-qualified name that starts with a \fB::\fR, there is no question about what command, variable, or namespace you mean. However, if the name does not start with a \fB::\fR -(i.e., is \fIrelative\fR), +(i.e., is \fIrelative\fR), Tcl follows basic rules for looking it up: Variable names are always resolved by looking first in the current namespace, @@ -477,7 +480,7 @@ set traceLevel 0 } .CE Here Tcl looks for \fBtraceLevel\fR first in the namespace \fBFoo::Debug\fR. -Since it is not found there, Tcl then looks for it +Since it is not found there, Tcl then looks for it in the global namespace. The variable \fBFoo::traceLevel\fR is completely ignored during the name resolution process. @@ -854,7 +857,6 @@ Remove all imported commands from the current namespace: .CS namespace forget {*}[namespace import] .CE - .SH "SEE ALSO" interp(n), upvar(n), variable(n) .SH KEYWORDS |