Ada 2012

A new version of Ada has become an international ISO standard. The new Ada reference manual can be found at http://www.ada-auth.org/standards/12rm/html/RM-TTL.html

Below is a brief survey of the more significant novel features of Ada 2012. They can be classified as follows:

The most important enhancements are those directly related to program correctness, namely the introduction of more powerful assertion mechanisms (predicates) in the language: pre- and postconditions for subprograms, type invariants, and subtype predicates. These are mechanisms that encourage the programmer to better specify the intent of the code they write, and allow the run-time to verify that this intent is in fact obeyed. These “programming by contract” features are also useful for static analysis tools.

There are a number of enhancements to the container library, including task-safe queues, and bounded containers that do not use dynamic allocation. There are iterator constructs over all forms of containers, that generalize loops over scalar ranges and arrays, and make containers easier to use.

There are numerous enhancements that contribute to expressiveness and readability of Ada programs: conditional expressions, case expressions, more powerful membership tests, quantified expressions, and expression functions.. Most of these are syntactic enhancements whose semantics is intuitive and fits well in Ada. Several of these are intended to simplify the writing of complex expressions that will frequently appear in pre- and postconditions, type invariants and subtype predicates.

One addition in this category has a larger conceptual import because it reverses an early design decision that had been controversial ever since Ada 83: functions will now have in and in out formal parameters.

Some enhancements concern visibility : more powerful use clauses, and additional uses of incomplete types that simplify the construction of nested containers.

There are several enhancements in the area of concurrency, memory barriers, processor affinity for tasks, extended suspension objects, and others. Several of these provide a better mapping of Ada programs to multicore architectures.

Each one of the enhancements mentioned above corresponds to one or more Ada Issues (AIs). For further details, please refer to the database at the Ada Information Clearinghouse (see http://www.ada-auth.org/AI05-SUMMARY.HTML where you will find up-to-date descriptions and a full list of Amendment AIs, along with their status, motivation and ongoing discussions). The annnotated Ada Reference Manual links each new feature of the language to the AI that motivates it.

Knowledge Center

Developer Gems    

  • Gem #149 : Asserting the truth, but (possibly) not the whole truth

    In Ada 2012, assertions that state desired properties of programs are not limited to pragma Assert. This Gem presents how pragma Assertion_Policy can be used to control which of these assertions should be executed at run time.

  • Gem #148 : Su(per)btypes in Ada 2012 - Part 3

    In the previous two Gems of this series, we saw how the aspects Static_Predicate and Dynamic_Predicate can be used to state properties of objects that should be respected at all times. This Gem is concerned with the Type_Invariant aspect.