[Xotcl] xotcl namespace auto-import
nem at cs.nott.ac.uk
Mon May 24 22:57:09 CEST 2004
Small feature request: could XOTcl be made to automatically [namespace
import] the ::xotcl::* commands into every object it creates? I'm
trying to write a package using XOTcl, and so don't want to import
XOTcl into the global namespace. As Tcl's command resolution rules are
current namespace then global namespace only, I can't just import it
into my package namespace, as all objects (which are sub-namespaces,
AIUI) would skip the containing namespace when resolving. So, I have
1) Fully qualify everything - lots of xotcl::my, xotcl::self etc
2) Import xotcl namespace manually into each object namespace.
2 is better than 1, but is still a bit of a pain to remember to do, and
I seem to remember trying it and it not always working (I could be
wrong about that).
So, my feature request would be that all Objects [namespace import] the
xotcl namespace automatically.
 [namespace import] is actually quite expensive as it creates
commands in each namespace which forward on to the originals. Possibly
if XOTcl is already hooked in to Tcl's resolver APIs for method
dispatch/inheritance, then the xotcl namespace could just be added as a
final search path (after xotcl::Object).
More information about the Xotcl