IEC 15291-12:2016 – Ada Semantic Interface Specification (ASIS) Part 12: Object-Oriented Extension

Expanding ASIS to support object‑oriented features in Ada 2005/2012

Introduction

The Ada Semantic Interface Specification (ASIS) defined in ISO/IEC 15291:1999 provides a standard interface for querying the structural and semantic information of Ada programs. However, the rapid adoption of object‑oriented features in Ada 2005 and Ada 2012 created a gap in the original specification. IEC 15291‑12:2016 (a joint ISO/IEC publication) fills this gap by defining a set of extensions that allow ASIS‐based tools to uniformly access class‑wide types, dispatching operations, abstract subprograms, interfaces and other object‑oriented constructs. This article details the scope, technical requirements, implementation highlights and compliance notes of this important extension.

Scope

IEC 15291‑12:2016 is Part 12 of the IEC 15291 series (also classified as ISO/IEC 15291‑12). It specifies additional ASIS query functions and data structures that expose the object‑oriented semantics of Ada programs. The standard covers:

  • Tagged types and class‑wide types
  • Primitive operations and dispatching
  • Abstract types and abstract subprograms
  • Interface types and interface conversions
  • Controlling parameters and result types
  • Object‑oriented constructs in generic units

The extension is designed to be fully backward‑compatible with the base ASIS standard (ISO/IEC 15291:1999) and integrates seamlessly with existing ASIS implementations. The target audience includes developers of cross‑reference tools, documentation generators, refactoring engines, and static analysis tools for Ada.

Technical Requirements

The core of IEC 15291‑12:2016 is an API that adds new query categories and query functions. Below is a summary of the most significant additions.

Query Categories

The standard defines five new query categories, each corresponding to a group of related object‑oriented queries:

  • ClassWideTypes – queries for examining Class type attributes and accessing specific tagged type views.
  • DispatchingOperations – queries that retrieve dynamically dispatched subprograms, operators, and entries.
  • Abstract – queries that identify abstract types and subprograms.
  • Interface – queries that retrieve interface types, interface ancestors, and interface conversions.
  • ControllingParameters – queries that determine controlling parameters and controlling result types in dispatching situations.
Selected query functions added by IEC 15291‑12:2016
Query Name Category Description
Is_Tagged_Type ClassWideTypes Returns True if the given type is a tagged type (including class‑wide types).
Tagged_Type_Primitive_Operations DispatchingOperations Returns a list of all primitive subprograms available for a tagged type (inherited and defined).
Is_Abstract_Type Abstract Determines whether a type is declared as abstract.
Interface_Ancestors Interface Returns the list of interface types that are ancestors of a given type.
Controlling_Parameters ControllingParameters For a dispatching operation, returns the set of formal parameters that control the dispatch.

Each query function returns standard ASIS Element iterators or scalar results, as appropriate. The calling conventions follow the patterns established in ISO/IEC 15291:1999 to minimise the learning curve for existing users.

Implementation Highlights

Implementors of IEC 15291‑12:2016 should note several key design decisions:

  • Extension of the ASIS Abstract Syntax Tree (AST): The new queries traverse the existing ASIS AST nodes without requiring a separate representation. Nodes for tagged types and interfaces are already present in the Ada AST; the extension simply defines how to retrieve their specific OO attributes.
  • Context‑sensitive dispatching: The queries for dispatching operations take into account the current context (e.g., within a generic instantiation). Implementations must honour the visibility rules of Ada to avoid returning irrelevant or hidden primitives.
  • Integration with existing ASIS implementations: The extension is designed as a separate package (Asis.Objects_Oriented) that can be loaded on top of any compliant ASIS implementation. This allows incremental adoption without disrupting existing toolchains.
Tip: When implementing IEC 15291‑12:2016, reuse the base ASIS traversal routines and simply add the new query functions. This ensures that your implementation automatically benefits from improvements in the underlying ASIS engine.
Caution: The queries related to generic units must be handled carefully. Object‑oriented constructs inside generics may not be fully expanded until instantiation. Implementations may need to provide a “pre‑instantiation” view and a “post‑instantiation” view; the standard defines a flag that allows the caller to choose.

Compliance Notes

IEC 15291‑12:2016 includes a comprehensive compliance clause that defines two levels of conformity:

  • Core Compliance: The implementation must support all queries in the five categories listed above, returning correct results for legal Ada code conforming to Ada 2005/2012.
  • Full Compliance: In addition to core requirements, the implementation must correctly handle the interaction between object‑oriented features and other Ada features such as discriminants, limited types, and formal packages. It must also support queries on code that uses violation of OO features (e.g., attempts to call an abstract subprogram). Full compliance also requires the implementation to provide a mechanism for reporting errors consistently with other ASIS error models.
Compliance benefit: Achieving IEC 15291‑12:2016 certification for your Ada tool ensures that your users can rely on uniform behaviour across different platforms. It also streamlines the integration of your tool with ASIS‑based environments such as GPS (GNAT Programming Studio) and other lint‑style analysers.
Non‑compliance risk: A tool that does not conform to IEC 15291‑12:2016 may produce incomplete or incorrect results when analyzing modern Ada code containing tagged types, interfaces, or dispatching operations. This can lead to false positives in static analysis and broken refactoring scripts.

The standard also requires that implementations undergo a validation test suite provided by ISO/IEC JTC 1/SC 22/WG 9. The test suite covers typical OO Ada constructs and checks that query results match the expected semantics defined in the Ada Reference Manual.

Frequently Asked Questions

Q: Is IEC 15291‑12:2016 backward‑compatible with tools that already support ISO/IEC 15291:1999?
A: Yes. The extension is designed as an upward‑compatible add‑on. Existing ASIS queries continue to work unchanged. The new query functions are located in a separate child package (Asis.Objects_Oriented). An implementation is only required to provide the extension if it claims compliance with Part 12.
Q: Does IEC 15291‑12:2016 cover object‑oriented features introduced in Ada 2022?
A: No. The standard specifically addresses Ada 2005 and Ada 2012. Features added in Ada 2022 (e.g., contracts on dispatching calls, pre/postconditions on abstract subprograms) are not included. A future part may address these extensions.
Q: Can I use IEC 15291‑12:2016 with my existing Ada 95 code base?
A: Yes. The extension will simply return empty lists or False for object‑oriented queries on Ada 95 code, which has no tagged types or interfaces. There is no performance penalty for using the extension with older code.
Q: Where can I obtain the validation test suite?
A: The official test suite is distributed by ISO/IEC through your national standards body. Some parts are also available in open source form from the Ada‐resources project on GitHub. Check the IEC Webstore for official compliance kits.

— IEC 15291‑12:2016 — Published in 2016, reaffirmed 2021.  © 2026 ISO/IEC. All rights reserved.

📥 Standard Documents Download

🔒
Please wait 10 seconds, the download links will appear after the ad loads

Leave a Reply

Your email address will not be published. Required fields are marked *