-
Notifications
You must be signed in to change notification settings - Fork 30
Description
Summary
This RFC introduces a new ghost attribute, called Loop_Index,
that can be applied to the loop parameter of a generalized iterator to get the
underlying index or cursor.
Motivation
Currently, it is often not possible to use array component iterators and
container element iterators in loops in SPARK as loop invariants generally need
to refer to the underlying loop index or cursor.
It would be possible to use the ghost attribute Loop_Index inside the pragma
Loop_Invariant or Loop_Variant of loops with array component iterators
or container element iterators, making it possible to use this pattern in SPARK.
This feature should work both for array component iterators and for container
element iterators based on the Iterable aspect.
It should be executable when ghost code is enabled.
Caveats and alternatives
TBD