6.8 Expression Functions
1/3
Syntax
2/3
Name Resolution Rules
3/3
Legality Rules
4/3
5/3
{
AI05-0177-1}
If the result subtype has one or more unconstrained
access discriminants, the accessibility level of the anonymous access
type of each access discriminant, as determined by the expression
of the expression function, shall not be statically deeper than that
of the master that elaborated the expression_function_declaration.
5.a/3
Ramification: This
can only fail if the discriminant is an access to a part of a non-aliased
parameter, as there can be no local declarations here.
5.b/3
Discussion: We
don't need to repeat any of the other Legality Rules for return statements
since none of them can fail here: the implicit return statement has to
apply to this function (and isn't nested in something), there clearly
is a return statement in this function, and the static classwide accessibility
check cannot fail as a tagged type cannot be declared locally in an expression
function.
Static Semantics
6/3
Dynamic Semantics
7/3
7.a/3
Discussion: The
last sentence effectively means that all of the dynamic wording in 6.5
applies as needed, and we don't have to repeat it here.
8/3
Examples
9/3
{
AI05-0177-1}
function Is_Origin (P : in Point) return Boolean is -- see 3.9
(P.X = 0.0 and P.Y = 0.0);
Extensions to Ada 2005
9.a/3
{
AI05-0177-1}
Expression functions are new
in Ada 2012.
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe