Re: A question on using a namespace



Robert Hicks schrieb:
I was playing around with the inifile package to read and write a test
ini. Works great no problems.

I was wondering though...do I have to type ::ini::whatever or is there
a way to shorten those? Or do you really not want to because it is a
"namespace" and you don't want to trod over other commands?

There are some ways to do this. There is namespace import and interp alias.

If you import a command into your own namespace (or the global one, but
that can be desaster, if you import something like info or set), you can
use the shorter name.

Michael

.



Relevant Pages

  • Re: Doing export from a nested namespace
    ... a direct way to link a namespace to a shorter name in this manner. ... pretty deeply embedded in the C API too so changing things is tricky.) ...
    (comp.lang.tcl)
  • Re: Doing export from a nested namespace
    ... a direct way to link a namespace to a shorter name in this manner. ... I think what "namespace path" provides is the closest what I need. ... Tcl 8.4.1 ...
    (comp.lang.tcl)
  • Re: Namespace ensembles and interp hide/expose/invokehidden
    ... hide/expose/invokehidden mechanism of slave interpreters, ... I'll just say straight out this means hidden commands are broken. ... namespace, ...
    (comp.lang.tcl)
  • Re: Namespace ensembles and interp hide/expose/invokehidden
    ... I'll just say straight out this means hidden commands are broken. ... movement toward support for the multi-namespace reality of Tcl 8.*. ... - the hide/expose/invokehidden mechanism can be used only on commands in the ... root namespace ...
    (comp.lang.tcl)
  • Re: Trouble with namespace delete in tcl8.5+ - extremely slow.
    ... as well as removing all corresponding interp aliases - but this makes ... (the tidyup code is fast - but the namespace delete still takes ... It involves a text widget with bindings to commands that are aliases ... That should give you some idea of trace scripts being evaluated, ...
    (comp.lang.tcl)