Summary
This final chapter summarizes various overall aspects of Ada. The first three sections cover some general topics which have been introduced in stages throughout the book. There is then a section on the important issue of portability. The penultimate section airs a few philosophical thoughts about programming in general and Ada in particular. And then the last section is an introduction to the SPARK language which is based on Ada and is used for those essential high integrity systems where life and limb and the environment are at risk if the software is incorrect.
Names and expressions
The idea of a name should be carefully distinguished from that of an identifier. An identifier is a syntactic form such as Fred which is used for various purposes including introducing entities when they are declared. An operator has a similar status to an identifier; operators and identifiers are collectively referred to as direct names in the syntax. A name, on the other hand, may be more complex and is the form used to denote entities in general. The reader might find it helpful to consult the syntax in Appendix 3 and especially items 41 (name), 42 (direct_name), and 55 (primary).
Syntactically, a name typically starts with an identifier such as Fred or an operator symbol such as “+” and can then be followed by one or more of the following in an arbitrary order
• one or more index expressions in parentheses; this denotes a component of an array,
• a discrete range in parentheses; this denotes a slice of an array,
• an apostrophe plus an identifier, possibly indexed; this denotes an attribute,
• a dot followed by an identifier, operator or all; this denotes a record component, an object designated by an access value, or an entity in a package, task, protected object, subprogram, block or loop,
• an actual parameter list in parentheses; this denotes a function call.
Type conversions, qualified expressions, and character literals are also treated as names in the syntax. Character literals are considered to be parameterless functions and can be renamed. In addition, generalized references and generalized indexing, which were discussed in Section 21.6, are also considered to be names.
Names are just one of the primary components of an expression.
- Type
- Chapter
- Information
- Programming in Ada 2012 , pp. 823 - 850Publisher: Cambridge University PressPrint publication year: 2014