Dan Sugalski <[EMAIL PROTECTED]> wrote:
> At 12:49 PM +0100 1/16/04, Leopold Toetsch wrote:
>>
>>    find_global P1, P2 ['global'; 'namespace'; 'hierarchy'; "thingname" ]

> No. The thing will be a separate parameter.

Why? Nested keys get you down the key chain until there is no more key.
This can be a variable (above case) or another namespace PMC. Above
lookup can be totally cached. When "thingname" is separate at least 2
hash lookups are necessary. Or if a separate "thingname" is there just
append it - should be equivalent.

>>The original syntax would need heavy modifications in the assembler, the
>>latter fits nicely.

> We can cope. The assembler needs a good kick with regards to keyed
> stuff anyway, I expect, and we're going to need this for constructing
> keys at runtime, something we've not, as yet, addressed.

We have:

$ cat k.pasm
   new P1, .PerlHash
   new P2, .PerlString
   set P2, "hello\n"
   set P1["b"], P2
   new P3, .PerlHash
   set P3["a"], P1

   set P5, P3["a"; "b"] # HoH access by key cons
   print P5

   new P6, .Key
   set P6, "a"
   new P7, .Key
   set P7, "b"
   push P6, P7
   set P5, P3[P6]       # fully dynamic HoH access
   print P5

   end

$ parrot k.pasm
hello
hello

leo

Reply via email to