carbon-lang icon indicating copy to clipboard operation
carbon-lang copied to clipboard

Reorder type and length in array type syntax

Open asoffer opened this issue 2 years ago • 0 comments

This proposal is to have the syntax for an array type specify the length before the type to address the issue that array extents are in reverse order from how the array is indexed. That is, given an array of length 5, each element of which is an array of 10 i32s, consider a variable declaration along with an indexing into the "last" element.

Before:

var array: [[i32; 10]; 5]
var element: array[4][9]

After:

var array: [5; [10; i32]]
var element: array[4][9]

asoffer avatar Jul 28 '22 00:07 asoffer