Re: SRFI 268: Multidimensional Array Literals
John Cowan 02 Apr 2026 02:16 UTC
On Wed, Apr 1, 2026 at 9:13 PM Per Bothner <xxxxxx@bothner.com> wrote:
> I was thinking about SRFI-style numeric vectors.
> For example #u32(1 1)((4 5) (10 12)) - is this a 2*2 u32 rank-2 array
> with lower bounds (1 1) and datum ((4 5) (10 12)) - or it is
> a u32vector with length 2, followed by a list of lists
268 does not assign a meaning to that. In 4 or 160, it is the latter.
> The SRFI-268 specification states that the '#' is followed by an
> optional type tag
In fact it says "An array literal consists of the following parts: an
# immediately followed by an optional non-negative integer literal
representing the number of dimensions, immediately followed by a tag
that specifies the type of the elements of the array." So in this
SRFI, unlike SRFI 163, the A is not a tag, The word "optional" should
have appeared before "tag".
So under my revised proposal the EBNF is:
array-literal ::= "#a" [tag] bounds datum
tag ::= u8 | ... | u64 | s8 | ... | s64 | f32 | f64 | c64 | c128
bounds ::= "(" bound* ")"
bound ::= integer | "(" integer integer ")"
Implementations may extend the set of tags.
> but the examples seem to show that the '#'
> must be followed by 'a'.
Correctly so.