On Fri, Jun 30, 2006 at 10:50:58PM -0700, Matt Diephouse wrote: > Chip Salzenberg <[EMAIL PROTECTED]> wrote: > >On Wed, Jun 28, 2006 at 11:40:28PM -0700, Matt Diephouse wrote: > >> Tcl uses C< .namespace [''] > to refer to the root namespace (correctly, > >> I think) and I can't think of any language that would want to differentiate > >> between the two. > > > >All you need to disprove this speculation is one counterexample, and the > >counterexample doesn't even have to exist yet. > > Fair enough. But one question remains: how do you tell IMCC that you > want to be in the root HLL namespace? C< .namespace [] > is a parse > error.
No answer for you yet. Bug report on that one, please; at first blush I think the solution is that ".namespace" without parameters should be the root, or that some pseudo-HLL, perhaps the default "parrot" one, should have the root namespace as its HLL namespace. > >> Also, is there any reason we can't/shouldn't add find_global variants > >> that lookup globals in HLL's? Right now we have find_global_p_p_s. > >> Adding find_global_p_s_p_s would let me reach into Tcl's private very > >> easily instead of having to crawl the namespaces myself. > > > >It's three steps rather than one, but it's not crawling, and it's already > >in the pdd, mostly: > > > > .local pmc tcl > > tcl = compreg "tcl" > > > > .local pmc ns > > ns = tcl.'get_namespace'(['Foo';'Bar']) > > > >I'm cheating a little here because I'm showing you an example with a key > >(which the docs don't specifically allow) rather than an array (which they > >do allow), but the point is to demonstrate compiler.get_namespace(). > > This doesn't work for *private* namespaces -- only public ones. ParTcl > currently uses a macro to crawl its private namespaces, which AFAIK is > the *only* way to access the helper subs it has in private namespaces. Oh. Well, if tcl is looking up its _own_ private namespace, and if I understand what you mean by "private namespace" (that's not a standard Parrot term of art), and (IIRC) Tcl namespaces are untyped, then you can take advantage of the untyped interface which accepts (or should accept!) a multi-dimensional key: .local pmc private_ns private_ns = get_namespace '_tcl' ... .local private_foo_bar private_foo_bar = private_ns['Foo';'Bar'] -- Chip Salzenberg <[EMAIL PROTECTED]>