Download presentation
Presentation is loading. Please wait.
Published byGrant Vernon Sparks Modified over 9 years ago
1
Directions for the Next Generation of Ada Randall Brukardt, ARG Editor AXE Consultants
2
Problem: Mutually Dependent Packages Occurs when two types have components that depend on the other type. Common in Object-Oriented designs, especially those ported from Java or C++.
3
An (illegal) Ada 95 example with Employees; package Departments is type Department is record Manager : Employees.Employee_Access; end record; type Department_Access is access all Department; end Departments; with Departments; package Employees is type Employee is record Department : Departments.Department_Access; end record; type Employee_Access is access all Employee; end Employees;
4
The ARG searches for solutions…. With Type Package Abstracts Incomplete type stubs
5
package Employee_Interface is type Employee is separate; type Employee_Access is access all Employee; end Employee_Interface; with Employee_Interface; package Departments is type Department is record Manager : Employee_Interface.Employee_Access; end record; -- as before. end Departments;
6
Features of incomplete type stubs Can be completed anywhere. Only one completion per program. Needed for type safety. If the completion is visible, the stub acts as a subtype of the completing type. If the completion is not visible, the stub is restricted as with normal incomplete types.
7
Advantages of incomplete stubs Implementation is similar to incomplete types deferred to a body - a feature Ada 95 already has. No new compilation unit needed. Completion is not required (useful for prototyping). Access types can be used (unlike with type).
8
Disadvantages of incomplete stubs None yet -- to be determined.
9
Problem: Accidental overloading instead of overriding Object-oriented programming problem: If a subprogram profile does not conform to the original profile, the subprogram often will overload rather than override a routine. Also a maintenance problem: if the base class is modified, overriding routines may silently change to overloading, breaking the application.
10
Solution: Pragmas to declare overriding Pragma Overriding declares that a subprogram is intended to be overriding. If it doesn’t override something, an error is flagged. Configuration pragma Explicit_Overriding declares that all overriding is marked by pragma Overriding. If a subprogram overrides that is not marked, an error is flagged.
11
Example of pragma Overriding package Root is type Root_Window is tagged... procedure When_Notify ( Window : in out Root_Window; Code : in Natural); end Root; with Root; package App is type Application_Window is new Root_Window... procedure When_Notify ( Window : in out Application_Window); pragma Overriding (When_Notify); -- Error here. end App;
12
Problem: No way to create or search directories in Ada Most operating systems have directories, but Ada does not provide a standard to do directory operations. Most Ada compilers provide a package to do this. Commonly supported by the standard for other languages (for example, C).
13
Solution: Package Ada.Directories Create and remove directories. Set and retrieve the current directory. Search a directory. Delete by name and renaming of files and directories. Full/simple name conversions. (TBD) File name decomposition functions.
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.