Ada-Rapporteur-Group / User-Community-Input

Ada User Community Input Working Group - Github Mirror Prototype
27 stars 1 forks source link

Allow constrained array as target of access-to-unconstrained array type #10

Open sttaft opened 2 years ago

sttaft commented 2 years ago

3.10.2(27-27.2) requires that an aliased array be declared unconstrained if you plan to use 'Access to create a value of an access-to-unconstrained-array type. This requires you to provide an initialization expression so it can be constrained by its initial value. This is annoying if the variable is imported, since an import cannot have an initialization expression. It can also be annoying if you want to specify the bounds in the declaration and then use a positional array aggregate for the initialization expression and use the bounds to verify that there are the correct number of elements in the positional aggregate.

Possible solution: It would be nice to allow the use of a constrained array subtype for such an aliased array, and then perhaps have an aspect to say that the array should be represented so that it can be used as the object designated by an access-to-unconstrained-array value. For example "X : aliased Arr (1..10) with Target_Of_Access_To_Unconstrained;"

From Ada Community Input: Tucker Taft | taft@adacore.com | 5/17/2022 14:31:39