Ada Programming/Ada 2005
This is an overview of the major features that are available in Ada 2005, the version of the Ada standard that was accepted by ISO in January 2007 (to differentiate it from its predecessors Ada 83 and Ada 95, the informal name Ada 2005 is generally agreed on). For the rationale and a more detailed (and very technical) description, see the Amendment to the Ada Reference Manual following the links to the last version of every Ada Issue document (AI).
Although the standard is now published, not all compilers will be able to handle it. Many of these additions are already implemented by the following Free Software compilers:
- GNAT GPL Edition
- GCC 4.1
- GNAT Pro 6.0.2 (the AdaCore supported version) is a complete implementation.
After downloading and installing any of them, remember to use the
-gnat05 switch when compiling Ada 2005 code. Note that Ada 2005 is the default mode in GNAT GPL 2007 Edition.
Not only does Ada 2005 now support a new 32-bit character type — called Wide_Wide_Character — but the source code itself may be of this extended character set as well. Thus Russians and Indians, for example, will be able to use their native language in identifiers and comments. And mathematicians will rejoice: The whole Greek and fractur character sets are available for identifiers. For example, Ada.Numerics will be extended with a new constant:
This is not a new idea — GNAT always had the -gnatic compiler option to specify the character set . But now this idea has become standard, so all Ada compilers will need to support Unicode 4.0 for identifiers — as the new standard requires.
Interfaces allow for a limited form of multiple inheritance similar to Java and C#.
You find a full description here: Ada Programming/OO.
- AI95-00251-01 Abstract Interfaces to provide multiple inheritance
- AI95-00345-01 Protected and task interfaces
In addition to Ada's safe variant record an unchecked C style union is now available.
You can find a full description here: Ada Programming/Types/record#Union.
- AI95-00216-01 Unchecked unions -- variant records with no run-time discriminant
- Annex B.3.3 Pragma Unchecked_Union (Annotated)
The with statement got a massive upgrade. First there is the new limited with which allows two packages to with each other. Then there is private with to make a package only visible inside the private part of the specification.
Not null accessEdit
An access type definition can specify that the access type can never be null.
The possible uses of anonymous access types are extended. They are allowed virtually in every type or object definition, including access to subprogram parameters. Anonymous access types may point to constant objects as well. Also, they could be declared to be not null.
With the addition of the following operations in package Standard, it is possible to test the equality of anonymous access types.
function"=" (Left, Right : universal_access)
function"/="(Left, Right : universal_access)
A major addition to the language library is the generic packages for containers. If you are familiar with the C++ STL, you will likely feel very much at home using Ada.Containers. One thing, though: Ada is a block structured language. Many ideas of how to use the STL employ this feature of the language. For example, local subprograms can be supplied to iteration schemes.
If you know how to write Ada programs, and have a need for vectors, lists, sets, or maps (tables), please have a look at the AI95-00302-03 AI Text mentioned above. There is an !example section in the text explaining the use of the containers in some detail. Matthew Heaney provides a number of demonstration programs with his reference implementation of AI-302 (Ada.Containers) which you can find at tigris.
In Ada Programming/Containers you will find a demo using containers.
Historical side note: The C++ STL draws upon the work of David R. Musser and Alexander A. Stepanov. For some of their studies of generic programming, they had been using Ada 83. The Stepanov Papers Collection has a few publications available.
Scan Filesystem Directories and Environment VariablesEdit
(Related note on Ada programming tools: AI-388 contains an interesting assessment of how compiler writers are bound to perpetuate the lack of handling of international characters in programming support tools for now. As an author of Ada programs, be aware that your tools provider or Ada consultant could recommend that the program text be 7bit ASCII only.)
Real-Time and High Integrity SystemsEdit
- AI95-00297-01 Timing events
- AI95-00307-01 Execution-Time Clocks
- AI95-00354-01 Group execution-time budgets
- AI95-00266-02 Task termination procedure
- AI95-00386-01 Further functions returning Time_Span values
- AI95-00249-01 Ravenscar profile for high-integrity systems
- AI95-00305-01 New pragma and additional restriction identifiers for real-time systems
- AI95-00347-01 Title of Annex H
- AI95-00265-01 Partition Elaboration Policy for High-Integrity Systems
New scheduling policiesEdit
- AI95-00355-01 Priority Specific Dispatching including Round Robin
- AI95-00357-01 Support for Deadlines and Earliest Deadline First Scheduling
- AI95-00298-01 Non-Preemptive Dispatching
Dynamic priorities for protected objectsEdit
See also: AI95-00327-01 Dynamic ceiling priorities
Summary of what's newEdit
Added 3 keywords (72 total)
Added 11 pragmas:
Added 7 attributes:
- Container library:
- Ada.Containers.Generic_Array_Sort (generic procedure)
- Ada.Containers.Generic_Constrained_Array_Sort (generic procedure)
- Vector and matrix manipulation:
- String hashing:
- Ada.Strings.Hash (generic function)
- Ada.Strings.Fixed.Hash (generic function)
- Ada.Strings.Bounded.Hash (generic function)
- Ada.Strings.Unbounded.Hash (generic function)
- Ada.Strings.Wide_Hash (generic function)
- Ada.Strings.Wide_Fixed.Wide_Hash (generic function)
- Ada.Strings.Wide_Bounded.Wide_Hash (generic function)
- Ada.Strings.Wide_Unbounded.Wide_Hash (generic function)
- Ada.Strings.Wide_Wide_Hash (generic function)
- Ada.Strings.Wide_Wide_Fixed.Wide_Wide_Hash (generic function)
- Ada.Strings.Wide_Wide_Bounded.Wide_Wide_Hash (generic function)
- Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Hash (generic function)
- Tagged types:
- Ada.Tags.Generic_Dispatching_Constructor (generic function)
- Text packages:
- Wide_Wide_Character packages:
- Execution-time clocks:
- Timing events:
- Task termination procedures:
- Ada Programming/Ada 83
- Ada Programming/Ada 95
- Ada Programming/Ada 2012
- Ada Programming/Object Orientation
- Ada Programming/Types/access
- Ada Programming/Keywords
- Ada Programming/Keywords/and
- Ada Programming/Keywords/interface
- Ada Programming/Attributes
- Ada Programming/Pragmas
- Ada Programming/Pragmas/Restrictions
- Ada Programming/Libraries/Ada.Containers
- Ada Programming/Libraries/Ada.Directories
Pages in the category Ada 2005Edit
Papers and presentationsEdit
- Ada 2005: Putting it all together (SIGAda 2004 presentation)
- GNAT and Ada 2005 (SIGAda 2004 paper)
- An invitation to Ada 2005, and the presentation of this paper at Ada-Europe 2004
- Rationale for Ada 2005 by John Barnes:
- Object Oriented Model
- Access Types
- Structure and Visibility
- Tasking and Real-Time
- Exceptions, Generics, Etc.
- Predefined Library
Available as a single document for printing.
- Instructions to the Ada Rapporteur Group from SC22/WG9 for Preparation of the Amendment to ISO/IEC 8652 (10 October 2002), and a presentation of this document at SIGAda 2002
Ada Reference ManualEdit
- Ada Reference Manual, ISO/IEC 8652:1995(E) with COR.1:2001 and AMD.1:2007
- Annotated Ada Reference Manual, ISO/IEC 8652:1995(E) with COR.1:2001 and AMD.1:2007 (colored diffs)
- List of Ada Amendment drafts
- Amendment 200Y
- AI95-00387-01 Introduction to Amendment
- AI95-00284-02 New reserved words
- AI95-00252-01 Object.Operation notation
- AI95-00218-03 Accidental overloading when overriding
- AI95-00348-01 Null procedures
- AI95-00287-01 Limited aggregates allowed
- AI95-00326-01 Incomplete types
- AI95-00317-01 Partial parameter lists for formal packages
- AI95-00376-01 Interfaces.C works for C++ as well
- AI95-00368-01 Restrictions for obsolescent features
- AI95-00381-01 New Restrictions identifier No_Dependence
- AI95-00224-01 pragma Unsuppress
- AI95-00161-01 Default-initialized objects
- AI95-00361-01 Raise with message
- AI95-00286-01 Assert pragma
- AI95-00328-01 Preinstantiations of Complex_IO
- AI95-00301-01 Operations on language-defined string types
- AI95-00340-01 Mod attribute
- AI95-00364-01 Fixed-point multiply/divide
- AI95-00267-01 Fast float-to-integer conversions
- AI95-00321-01 Definition of dispatching policies
- AI95-00329-01 pragma No_Return -- procedures that never return
- AI95-00362-01 Some predefined packages should be recategorized
- AI95-00351-01 Time operations
- AI95-00427-01 Default parameters and Calendar operations
- AI95-00270-01 Stream item size control