Next: 8 Iterators/Streams
Up: Differences between Sather-1.0 and
Previous: 6 Compositionality
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.
- S1 only allows a single contiguous primitive array portion,
obtained by including
(or
). 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.)
- In SK, dimensionality becomes part of the type name.
and
sugar are not permitted
unless the class name contains [*,*] notation. Dynamic value
arrays
and static value arrays
allow only one dimension. In this case of
and
flexible reference arrays
, the dimension is
part of the type. Instead of using a *, integer constants are
also allowed. For the type, only
distinguishes
the value of those constants. E.g.
and
different types, while
and
are equal types.