On Tue, Aug 19, 2008 at 1:47 PM, chromatic <[EMAIL PROTECTED]> wrote:
> On Mon, Aug 18, 2008 at 04:49:59PM -0400, Will Coleda wrote:
>
>> > I'm pretty sure that Rakudo and Tcl want different things from NameSpaces.
>> > This code has a strong smell.

For those playing at home: This code is taking a string like
"Foo::Bar::::::Baz", splitting it up into String-y components, then
walking the namespace object under Tcl's HLL root to see if the given
namespace exists, failing if any of the parents are not found, since
that means the child can't possibly exist.

>> Can you be more specific as to the odor?
>
> Do namespaces nest?

pdd21 says yes, as does Tcl.

> Can you access them with String keys?  How about Key keys?

This code is using String keys. PDD21 says we can just treat the
namespace like a Hash if we like, and we did.

> What do you get when a key doesn't exist in the namespace?

We used to get PMCNULL; we now get an exception. I can trap the
exception in tcl, but I'd like to make sure this change in the vtable
of the namespace object is actually intentional; if so, then PDD21
needs to be updated to note this difference from the Hash behavior:
Hash just returns PMCNULL instead of throwing an exception when trying
to access an unset element.

I'm not opposed to changing the algorithm we use here to convert the
string name of the namespace into a key and look it up directly, as
long as I don't have to invoke the PIR compiler to do it; But the docs
would still need to be updated

On the other hand, if the docs are right and this should mimic Hash,
we need core tests to back it up.

> --
>
> Sunlight makes 3 AM jokes less funny.
>                        - Agent Smith
>

Regards.

-- 
Will "Coke" Coleda

Reply via email to