[clean-list] Sub-arrays

John van Groningen johnvg at cs.ru.nl
Fri Jun 2 16:57:32 MEST 2006


Matthew Bromberg wrote:
>..
>So my questions are
>1) How can I support a reference to the middle of an unboxed array (a subarray) and

In Clean an unboxed array of Reals consists of (for the 32 bit version):

offset 0:  ARRAY decriptor, 4 bytes
offset 4:  number of elements of the array, 4 bytes
offset 8:  REAL descriptor, 4 bytes
offset 12: Real values of the array

12 is added to the pointer to an array by the ccall instruction, so that in C
the values start at offset 0, and the number of elements is stored at
offset -8.

This makes it very difficult to support a reference to the middle of
an unboxed array, because the garbage collector should be able
to find the descriptors, and it should be possible to quickly
access the number of elements for testing whether an index is
too large.

>2)  How can I make such unique references  not be unique with respect to one another, if the blocks are non overlapping.

Uniqueness typing cannot express something like uniqueness with respect to
one another.

Kind regards,

John van Groningen


More information about the clean-list mailing list