Chip Salzenberg wrote:

  --- PART 2, IN WHICH AN ELEGANT SOLUTION IS PROPOSED --

On the other hand, we could extend the key PMC to represent emptiness,
i.e. zero dimensions.  This seems useful for namespaces and could even prove
useful for real keys.  And this makes keys even more compatible with the
Array interface, which I think they might need to implement someday anyway.

Allison, what do you think of zero-length keys, i.e. having [] construct a
Key PMC describing no dimensions of lookup?  If we use those we can get rid
of the current null-string hack.

Fundamentally altering the way keyed access works seems like a pretty extreme solution when the problem is just "the root HLL namespace doesn't have a name". (Actually, it does have a name: 'parrot', 'tcl', 'perl6', etc. A sort of "key who must not be named", if I won't be shot for making terrible Harry Potter references at 1am.)

It's simpler to give the root HLL namespace a name.

If zero-length keys are not OK, then...

  --- PART 3, IN WHICH AN UGLY BUT WORKING HACK IS DESCRIBED --

I introduced a hack in my recent namespace cleanups.  I was planning to
ask/warn users about it, but then forgot I'd done it, so it's in the svn
repo now.  The hack is:

When find_global or store_global expects a string or PMC to designate (name)
a namespace, Parrot takes a null value to name the HLL root namespace.

A null string could be canonized as the "name" of the root namespace, though something a little more meaningful and easier to type would be nice.

The problem is really that we're trying to simultaneously a) refer to the root HLL namespace directly, and b) pretend that it doesn't exist.

I had a much longer reply, but I'm going to let it steep overnight and see what percolates.

Allison

Reply via email to