View · Search · Index
No registered users in community xowiki
in last 10 minutes

[Xotcl] xotcl namespace auto-import

From: Neil Madden <nem_at_cs.nott.ac.uk>
Date: Mon, 24 May 2004 21:57:09 +0100

Hello all,

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
two options:

1) Fully qualify everything - lots of xotcl::my, xotcl::self etc
everywhere
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.[1]

Cheers,

Neil.

[1] [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).