next up previous
Next: 8 Iterators/Streams Up: Differences between Sather-1.0 and Previous: 6 Compositionality

7 Arrays

 

There are two essential differences between S1 and SK arrays. The functionality can be seen to be the same, although the way some uses are expressed can be seen to be quite different; for example, SK builds in higher-dimensioned arrays, while S1 constructs them as ordinary library classes.

  1. S1 only allows a single contiguous primitive array portion, obtained by including tex2html_wrap_inline556 (or tex2html_wrap_inline558 ). Higher dimensional arrays and objects with multiple conceptual array portions are then constructed as library classes.

    Instead of including a distinguished class, SK uses value-typed array attributes. (The same could have been done in S1, except value-typed arrays have constant size in S1. This constraint was inherited from C's equivalent restriction on structs.)

  2. In SK, dimensionality becomes part of the type name. tex2html_wrap_inline560 and tex2html_wrap_inline562 sugar are not permitted unless the class name contains [*,*] notation. Dynamic value arrays tex2html_wrap_inline566 and static value arrays tex2html_wrap_inline568 allow only one dimension. In this case of tex2html_wrap_inline566 and flexible reference arrays tex2html_wrap_inline572 , the dimension is part of the type. Instead of using a *, integer constants are also allowed. For the type, only tex2html_wrap_inline568 distinguishes the value of those constants. E.g. tex2html_wrap_inline578 and tex2html_wrap_inline580 different types, while tex2html_wrap_inline582 and tex2html_wrap_inline584 are equal types.