4.5.9 Declare Expressions
Declare expressions
provide a way to declare local constants and object renamings in an expression
context.
Syntax
Legality Rules
The following are not allowed within a
declare_expression:
a declaration containing the reserved word
aliased; the
attribute_designator
Access or Unchecked_Access; or an anonymous access type.
Name Resolution Rules
Dynamic Semantics
Examples
Example of use of
a declare expression as a replacement postcondition for Ada.Containers.Vectors."&"
(see A.18.2):
with Post =>
(declare
Result renames Vectors."&"'Result;
Length : constant Count_Type := Left.Length + Right.Length;
begin
Result.Length = Length and then
not Tampering_With_Elements_Prohibited (Result) and then
not Tampering_With_Cursors_Prohibited (Result) and then
Result.Capacity >= Length)
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe