Examples (GNAT Reference Manual) (original) (raw)
declare type Point is record X, Y : Integer; end record;
type Segment is array (1 .. 2) of Point; type Triangle is array (1 .. 3) of Segment;
S : Segment := (1 .. 2 => (0, 0)); T : Triangle := (1 .. 3 => (1 .. 2 => (0, 0))); begin S := (S with delta (1).X | (2).Y => 12, (1).Y => 15);
pragma Assert (S (1).X = 12); pragma Assert (S (2).Y = 12); pragma Assert (S (1).Y = 15);
T := (T with delta (2)(1).Y => 18); pragma Assert (T (2)(1).Y = 18); end;