DocAda(tm) is a productivity tool of KSCE

Prev | Up | Next | Back | Forward
About DocAda Light: Preface / Preliminary / Help / TOC / Copyright
DocAda Online at the Ada Home: Complete RM95 / Updates / News

12.4 Formal Objects

A generic formal object can be used to pass a value or variable to a generic unit.

Syntax

   
       formal_object_declaration ::=
           defining_identifier_list : mode subtype_mark [:= default_expression];

Name Resolution Rules

The expected type for the default_expression, if any, of a formal object is the type of the formal object.

For a generic formal object of mode in, the expected type for the actual is the type of the formal.

For a generic formal object of mode in out, the type of the actual shall resolve to the type of the formal.

Legality Rules

If a generic formal object has a default_expression, then the mode shall be in (either explicitly or by default); otherwise, its mode shall be either in or in out.

For a generic formal object of mode in, the actual shall be an expression. For a generic formal object of mode in out, the actual shall be a name that denotes a variable for which renaming is allowed (see 8.5.1).

The type of a generic formal object of mode in shall be nonlimited.

Static Semantics

A formal_object_declaration declares a generic formal object. The default mode is in. For a formal object of mode in, the nominal subtype is the one denoted by the subtype_mark in the declaration of the formal. For a formal object of mode in out, its type is determined by the subtype_mark in the declaration; its nominal subtype is nonstatic, even if the subtype_mark denotes a static subtype.

In an instance, a formal_object_declaration of mode in declares a new stand-alone constant object whose initialization expression is the actual, whereas a formal_object_declaration of mode in out declares a view whose properties are identical to those of the actual.

Dynamic Semantics

For the evaluation of a generic_association for a formal object of mode in, a constant object is created, the value of the actual parameter is converted to the nominal subtype of the formal object, and assigned to the object, including any value adjustment -- see 7.6.

About DocAda Light: Preface / Preliminary / Help / TOC / Copyright
DocAda Online at the Ada Home: Complete RM95 / Updates / News
Prev | Up | Next | Back | Forward


Copyright © 1994-1997 by Kempe Software Capital Enterprises. All Rights Reserved. For comments on this DocAda(tm) hypertext document, please write to KSCE, at docada@ksce.com