Aggregates as initial value of an array

Hello!
I’m stuck with this array construct.
Can’t find the syntax clue to initialize an array of records, with the particularity I aim to pass the array as an in out variable, without needing to pass en extra index (ID) info.

(for K_ID in Knot_ID => ^
Compile error: missing “,” at ^

even with -gnat2022 and -gnatX switches, or pragma Ada_2022;

   subtype Knot_ID is Integer range Head_Knot .. Tail_Knot;
   type Grid_Position is record 
      X : X_Dimension;
      Y : Y_Dimension; 
   end record;

   type Knot_record is record
      ID : Knot_ID;
      Pos : Grid_Position;
   end record;

   type Rope_array is array (Knot_ID'Range) of Knot_record;

(...)

   Rope_Positions, Previous_Rope_Positions : Rope_array := 
--    (others => (ID => Head_Knot, Pos => (0,0)));  --:FIXME:  ID => Knot_ID'Range
      (for K_ID in Knot_ID => (ID => K_ID => (ID => K_ID, Pos => (0,0))));

see Ada 2012/2012 Array Aggregates
see Overview of Ada 2022
Compiler is FSF gcc-gnat 12.2.0

William

Haaa !
my writing was incorrect :wink:

Should have written:

   (for K_ID in Knot_ID => (ID => K_ID, Pos => (0,0)));

(sorry for the ‘noise’)
William

So you worked it out?

Array aggregates are one of my favorite things about Ada. A lot of languages I’ve used, even some “expressive” ones, make you jump through all sorts of hoops to initialize an array.