At 10:16 PM +0100 4/17/02, Dave Mitchell wrote:
>On Wed, Apr 17, 2002 at 04:57:21PM -0400, Dan Sugalski wrote:
>>  At 9:48 PM +0100 4/17/02, Dave Mitchell wrote:
>>  >On Wed, Apr 17, 2002 at 04:34:12PM -0400, Simon Glover wrote:
>>  >>   I thought lexicals were going to live in a symbol table now? In which
>>  >>   case, they're definitely going to depend on implementing hashes first.
>>  >
>>  >The first does not necessarily imply the second.
>>
>>  True, but in this case it does. Symbol tables are hashes, as are the
>>  lexical scratchpads. (Hashes you can look up by integer index, mind,
>>  but hashes nonetheless)
>
>I'm not yet convinced that hashes are the best data structure for
>lexical symtabs, given their heirarchical and dynamic nature.
>But lets not get into that debate just now :-)

Oh, hashes are exactly what we want, but they're *special* hashes. :)

The hash PMC types used by symbol tables have the interesting 
property of being able to look entries up by offset, not by key, and 
the offset is determined by insertion order.

The perl 6 equivalent would be:

     %foo = ('a', 1, 'b', 2, 'c', 3);
     print %foo[2]

printing 3. Access by offset is fast, so we're fine. (We may even 
peek under the hood, just to be Extra Evil)

At the moment, we don't have to support cascading lexical 
scratchpads--since we know at compile time which variables we're 
accessing and where they come from, we can install trampoline entries 
in the current scope's scratchpad and not have to search outward at 
runtime.
-- 
                                         Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                       teddy bears get drunk

Reply via email to