On Thu, Jul 06, 2006 at 01:21:08AM -0700, Allison Randal wrote: > 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 don't think (b) is quite true. It's more that we're avoiding explicit re-coding of a known bit of environmental information, as in "the first floor of this building" rather than "the first floor of 123 main street". > Chip Salzenberg wrote: > >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". I brought it up partly because I was hoping you'd say something like, "Oh yeah, we're gonna need zero-length keys anyway for Perl 6". What is the parameter to operator:postcircumfix [] when a user says @array.[] ? > It's simpler to give the root HLL namespace a name. Indeed, it already has the name of "empty list" when a PMC array is the naming vehicle: $P0 = new .FixedPMCArray $P1 = get_namespace $P0 # that's the HLL root There are two kinds of lists in play for namespaces; one of them can have a length of zero (PMC array), but the other one can't (key), and the one that can be zero-length doesn't have convenience pasm syntax. > 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. I should emphasize that I've gone to the recent trouble of making namespace [''] *not* mean the HLL root for two reasons: (1) it's poor manners on the part of a VM to steal names from HLLs or users, and (2) when a user is working with an array of names, they'll want to be able to decompose the list -- which puts a string that used to be in the middle out on the front, or by itself -- without accidentally re-rooting the search. Possibility: If we introduce a pasm keyword Null to mean a pmc constant null (and perhaps a string contant null), then the null name could be easier to type. It could also be useful in other contexts. Gentle observation: [] is pretty easy to type, and offers consistency: $P2 = get_namespace ['a','b'] # two levels from root $P1 = get_namespace ['a'] # one level from root $P0 = get_namespace [] # zero levels from root Ugly hack / joke: If you were willing to look the other way, [] could be an alternative spelling for PMC Null. :-P -- Chip Salzenberg <[EMAIL PROTECTED]>