At 8:12 PM +0100 1/24/02, Juergen Boemmels wrote:
>Uri Guttman <[EMAIL PROTECTED]> writes:
>
>>    >> Is this then the same datatype as a Perl6 pair (cf '=>' op in Apo 3) ??
>>
>>    DS> Good point. it probably is, yes. (Though there may be potential
>>    DS> differences--depends on whether the scheme pair can only have scalars
>>    DS> on each side, or should allow other things)
>
>>  that can be handled by the compiler to some degree. and from my lisp
>>  knowledge, a dotted pair can contain anything in each node. so i expect
>>  scheme pairs to map nicely onto perl6 pairs.
>
>Correct, especially a list is nothing but a pair with another pair or
>an end-of-list-marker in its second element. To implement set-car! and
>set-cdr! both elements of this pair must be mutable

Hmmm. I think we can use one thing for both perl pairs and scheme 
pairs. We'll need to be careful in spots, though. Perl pairs must 
have scalars on either side. (Just as arrays and hashes can only hold 
scalars, not arrays or hashes or lists)

>  > this implies that pairs
>>  should be supported directly in parrot since you can do many
>>  optimizations knowing the array has only 2 elements. maybe even support
>>  some car/cdr depth variations? i don't see any perl use of cddar but who
>>  knows?
>
>Sure. One optimization that comes to my mind, is make the PMC big
>enough to hold 2 PMC-pointers. (actualy it is, if you abuse the
>data-pointer of which I don't know what its good for). My actual patch
>uses the same way PerlArray does with KEY* and KEYPAIR* and the needed
>indirections.

The data pointer's for hanging off, well, data from the PMC. Strings, 
arbitrary chunks of memory, structures to hold arrays and hashes. 
Y'know, stuff. We could easily make the cache have a PMC in the union.

-- 

                                        Dan

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

Reply via email to