Figure 27.

Constrained objects can't change constraints.

---------------------------------------------------------- -- This procedure illustrates thee consequences of LRM -- Section 3.2.1 paragraph 12. procedure Constrained_Objects_Cant_Change_Constraints is type No_default (LENGTH : natural) is record TEXT : string(1..LENGTH); end record; type Default (LENGTH : natural := 0) is record TEXT : string(1..LENGTH); end record; FIRST_NAME : No_default(8); WHOLE_NAME : Default(14); LAST_NAME : Default; begin -- I can let LAST_NAME hold a 5 character name. LAST_NAME := (LENGTH => 5, TEXT => "Jones"); -- Then I can stretch it to hold a 10 character name. LAST_NAME := (10, "Washington"); -- FIRST_NAME can hold an 8 character name. FIRST_NAME := (8, "Do-While"); -- But it can't shrink to hold a shorter one -- because it was constrained to be 8 characters -- when it was declared. FIRST_NAME := (4, "Dave"); -- ILLEGAL -- You might think WHOLE_NAME can be changed because -- it has a default length, but the fact is it was -- constrained to be 14 characters when it was -- declared, so it can't be changed either. WHOLE_NAME := (17, "George Washington"); -- ILLEGAL end Constrained_Objects_Cant_Change_Constraints;