Version 6 of namespace current

Updated 2006-06-12 09:16:40

namespace current

Returns the fully-qualified name for the current namespace. The actual name of the global namespace is "" (i.e., an empty string), but this command returns :: for the global namespace as a convenience to programmers.


Jasp The so called convenience of returning :: has actually become an annoyance for me. The following code is supposted to take the argument variable database, containing a procedure name, and get it's full path (prepend command works like append, except inserts the concentration of arguments at start of variable):

 if {[string range $database 0 1] != "::"} {
         ::emerald::data::prepend database [uplevel 1 {namespace current}] ::}

This code works fine all the time, except when namespace current returns ::. database then becomes something like ::::procedure instead of ::procedure. I'm going to do a check with if and not prepend :: for this result for now, can anyone recommend a better solution? I think namespace current needs an argument like -actual to prevent this behaviour.


See also:


Category Command - Tcl syntax help