diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2008-09-28 22:17:36 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2008-09-28 22:17:36 (GMT) |
commit | d41bad2545ee171add61111b71b9d8c5c3e89173 (patch) | |
tree | 33b115c93550ac4c16da41b57aba376b6af847bd /doc/namespace.n | |
parent | 58acf122398c693f3a99b458711b071301e10670 (diff) | |
download | tcl-d41bad2545ee171add61111b71b9d8c5c3e89173.zip tcl-d41bad2545ee171add61111b71b9d8c5c3e89173.tar.gz tcl-d41bad2545ee171add61111b71b9d8c5c3e89173.tar.bz2 |
Implement TIP 314. [Patch 1901783]
Diffstat (limited to 'doc/namespace.n')
-rw-r--r-- | doc/namespace.n | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/doc/namespace.n b/doc/namespace.n index f2bc686..faee9c8 100644 --- a/doc/namespace.n +++ b/doc/namespace.n @@ -7,7 +7,7 @@ '\" 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.33 2008/09/26 19:36:50 dgp Exp $ +'\" RCS: @(#) $Id: namespace.n,v 1.34 2008/09/28 22:17:39 dkf Exp $ '\" .so man.macros .TH namespace n 8.5 Tcl "Tcl Built-In Commands" @@ -731,6 +731,14 @@ name. Note that when this option is non-empty and the \fB\-subcommands\fR option is empty, the ensemble subcommand names will be exactly those words that have mappings in the dictionary. .TP +\fB\-parameters\fR +.VS 8.6 +This option gives a list of named arguments (the names being used during +generation of error messages) that are passed by the caller of the ensemble +between the name of the ensemble and the subcommand argument. By default, it +is the empty list. +.VE 8.6 +.TP \fB\-prefixes\fR . This option (which is enabled by default) controls whether the @@ -874,7 +882,27 @@ Remove all imported commands from the current namespace: .CS namespace forget {*}[namespace import] .CE +.PP +.VS 8.6 +Create an ensemble for simple working with numbers, using the +\fB\-parameters\fR option to allow the operator to be put between the first +and second arguments. +.CS +\fBnamespace eval\fR do { + \fBnamespace export\fR * + \fBnamespace ensemble\fR create -parameters x + proc plus {x y} {expr { $x + $y }} + proc minus {x y} {expr { $x - $y }} +} + +# In use, the ensemble works like this: +puts [do 1 plus [do 9 minus 7]] +.CE +.VE 8.6 .SH "SEE ALSO" interp(n), upvar(n), variable(n) .SH KEYWORDS command, ensemble, exported, internal, variable +'\" Local Variables: +'\" mode: nroff +'\" End: |