I've started implementing namespace support in Tcl this week (yay!). But I've run into a bit of trouble, so I have a couple questions:
The get_namespace opcode gets namespaces from the root namespace. Should it get namespaces from the HLL namespace instead? The PDD isn't explicit either way, but the usage I had in mind works better if it works from the HLL namespace. I've added a failing test that tries to get a namespace from the HLL. Is there any reason that [...; ''] and [...] couldn't refer to the same namespace? 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. It would simplify code generation for Tcl to have '' act like this. Here's some Perl that models what I'm trying to write for Tcl in PIR: my $command = "..."; my @namespace = split /::+/, $command; $name = pop @namespace; my $namespace = get_namespace(@namespace); my $sub = find_global($namespace, $name); $sub->(); Without the changes, I'll have to unshift 'tcl' to the front of every array I use to lookup namespaces, as well as check for empty strings (consider the input "::puts", which should refer to the "puts" global in the '' namespace). It's a lot of code that's not really necessary. 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. $P0 = find_global '_tcl', ['Foo'; 'Bar'], "baz" Thanks, -- matt diephouse http://matt.diephouse.com