On Apr 18, 2006, at 12:19 PM, Chip Salzenberg wrote:
On Tue, Apr 18, 2006 at 11:34:49AM -0400, Will Coleda wrote:
From the PDD:
=item $P0 = find_global $P1, $S0
=item $P0 = find_global $S0
Find $P0 as the variable $S0 in the current namespace. or in $P1,
relative
to the HLL root namespace.
Heh, I'm sleepy so I forgot that the C<find_global $P0, $S0> form
proposed
in my previous message is already spec'd.
Tada, done! :-)
I'm using the first version, but it's relative to the namespace set
in .namespace, not relative to the HLL root namespace (derived from
the .HLL directive)
That's definitely a bug.
On a side note, is there a way to get at the parent namespace if
you have
a namespace? I don't see anything in the PDD about it. (Seems you
can only
walk *down* the hierarchy, not up.)
That's true. Given aliasing there may not be just one parent, but
I don't
suppose the distant chance of that will keep you from wanting this
feature...?
Well, for the tcl interpreter/compiler, there's not a huge need.
Either I keep doing it the way I'm doing it now (and I'm *only* doing
it for getting at the internals at the moment); or you say bug and I
go back to doing it with find_global. Either works, I just want the
docs and the code to line up, and I don't want to have to jump
through too many hoops. I asked about getting the parent because in
this particular case, I know it's just one up, and having to go all
the way back to the top offended my sensibilities. =-)
As for the language itself, I'm fairly certain that you can't have a
parent/child relationship for namespaces in tcl that doesn't
correspond directly to the naming of those namespaces.
So, 'Foo::Bar' *has* to be the parent namespace of 'Foo::Bar::Baz'.
So I don't really *need* parrot to provide a way to do this,
presuming I know the name of the namespace, which I think I have to.
So, for now, don't consider this an RFE on my behalf. (Though I
reserve the right to come back in six months and demand it! =-)