Your browser does not support JavaScript! Skip to main content
Free 30-day trial DO-178C Handbook RapiCoupling Preview DO-178C Multicore Training Multicore Resources
Rapita Systems
 

Industry leading verification tools & services

Rapita Verification Suite (RVS)

  RapiTest - Unit/system testing  RapiCover - Structural coverage analysis  RapiTime - Timing analysis (inc. WCET)  RapiTask - Scheduling visualization  RapiCoverZero - Zero footprint coverage analysis  RapiTimeZero - Zero footprint timing analysis  RapiTaskZero - Zero footprint scheduling analysis  RapiCouplingPreview - DCCC analysis

Multicore Verification

  MACH178  MACH178 Foundations  Multicore Timing Solution  RapiDaemons

Engineering Services

  V&V Services  Data Coupling & Control Coupling  Object code verification  Qualification  Training  Consultancy  Tool Integration  Support

Industries

  Civil Aviation (DO-178C)   Automotive (ISO 26262)   Military & Defense   Space

Other

RTBx Mx-Suite Software licensing Product life cycle policy RVS Assurance issue policy RVS development roadmap

Latest from Rapita HQ

Latest news

SAIF Autonomy to use RVS to verify their groundbreaking AI platform
RVS 3.22 Launched
Hybrid electric pioneers, Ascendance, join Rapita Systems Trailblazer Partnership Program
Magline joins Rapita Trailblazer Partnership Program to support DO-178 Certification
View News

Latest from the Rapita blog

How to certify multicore processors - what is everyone asking?
Data Coupling Basics in DO-178C
Control Coupling Basics in DO-178C
Components in Data Coupling and Control Coupling
View Blog

Latest discovery pages

control_tower DO-278A Guidance: Introduction to RTCA DO-278 approval
Picture of a car ISO 26262
DCCC Image Data Coupling & Control Coupling
Additional Coe verification thumb Verifying additional code for DO-178C
View Discovery pages

Upcoming events

DASC 2025
2025-09-14
DO-178C Multicore In-person Training (Fort Worth, TX)
2025-10-01
DO-178C Multicore In-person Training (Toulouse)
2025-11-04
HISC 2025
2025-11-13
View Events

Technical resources for industry professionals

Latest White papers

Mitigation of interference in multicore processors for A(M)C 20-193
Sysgo WP
Developing DO-178C and ED-12C-certifiable multicore software
DO178C Handbook
Efficient Verification Through the DO-178C Life Cycle
View White papers

Latest Videos

Rapita Systems - Safety Through Quality
Simulation for the Motorola 68020 microprocessor with Sim68020
AI-driven Requirements Traceability for Faster Testing and Certification
Multicore software verification with RVS 3.22
View Videos

Latest Case studies

GMV case study front cover
GMV verify ISO26262 automotive software with RVS
Kappa: Verifying Airborne Video Systems for Air-to-Air Refueling using RVS
Supporting DanLaw with unit testing and code coverage analysis for automotive software
View Case studies

Other Resources

 Webinars

 Brochures

 Product briefs

 Technical notes

 Research projects

 Multicore resources

Discover Rapita

Who we are

The company menu

  • About us
  • Customers
  • Distributors
  • Locations
  • Partners
  • Research projects
  • Contact us

US office

+1 248-957-9801
info@rapitasystems.com
Rapita Systems, Inc.
41131 Vincenti Ct.
Novi
MI 48375
USA

UK office

+44 (0)1904 413945
info@rapitasystems.com
Rapita Systems Ltd.
Atlas House
Osbaldwick Link Road
York, YO10 3JB
UK

Spain office

+34 93 351 02 05
info@rapitasystems.com
Rapita Systems S.L.
Parc UPC, Edificio K2M
c/ Jordi Girona, 1-3
Barcelona 08034
Spain

Working at Rapita

Careers

Careers menu

  • Current opportunities & application process
  • Working at Rapita
Back to Top Contact Us

simpler_Ada_using renames for.complex.names

Breadcrumb

  1. Home
2013-05-28

The renames facility is just one of a long list of reasons why we are big Ada fans. Here I explain how the renames facility works and how it can help you write code which is both readable and traceable.

Within the Ada community, one of the guiding principles is tracing items to their source. For example if you are referencing item Gross_Weight from Vegetable.Potato and Fruit.Apple. then you could write:

Basket := Vegetable.Potato.Gross_Weight(PotatoCount) + 
				Fruit.Apple.Gross_Weight(AppleCount);

This unambiguously indicates the origin of the referenced items. However with the use of meaningful labels (e.g. Exhaust_Temperature rather than ETemp) code can on occasions get somewhat verbose. The initial reaction to this is to make use of use clauses which would allow – assuming the overload can be resolved:

Basket := Gross_Weight(PotatoCount) + Gross_Weight(AppleCount);

This is however discouraged as the benefit of traceability is considered to significantly outweigh brevity. Use clauses are by common agreement “a bad thing”. The alternative is to use renames which give a shorthand method of referencing items while retaining traceability e.g.:

declare
   function Apple_Weight   return KILOS renames Fruit.Apple.Gross_Weight;
   function Potato_Weight return KILOS renames Vegetable.Potato.Gross_Weight;
begin
    Basket := Apple_Weight(AppleCount) + Potato_Weight(PotatoCount);
end;

Another important principle to apply here is that renames should generally be limited to the minimum possible scope. This adheres to the traceability philosophy of the Ada community.

Another use of renames is to partially evaluate the name of an object. Consider the following code snippet:

type PERSONNEL_TYPE is record
   Employee_Num : EMPLOYEE_NUM_TYPE;
   Join_Date    : DATE_TYPE;
   Birthday     : DATE_TYPE;
end record;
type  WORKFORCE_TYPE is array (EMPLOYEE_NUM_TYPE) of PERSONNEL_TYPE;
  
procedure Check_Birthday ( Workers : WORKFORCE_TYPE;
                           Today   : DATE_TYPE ) is
begin
   for I in Workers'range loop
      if Workers(I).Birthday.Day   = Today.Day   and
         Workers(I).Birthday.Month = Today.Month 
      then
        Send_Card (Worker => Workers(I), 
                   Age    => Today.Year – Workers(I).Birthday.Year);
      end if;
   end loop; 
end;

As can be seen the body of the loop has to restate the “Workers(I).Birthday” for each element Day/Month/Year of the record. Again a small rewrite could give:

for I in Workers'range loop
    declare
        DoB : DATE_TYPE renames Workers(I).Birthday;
    begin
        if DoB.Day   = Today.Day   and
           DoB.Month = Today.Month 
        then
            Send_Card ( Worker => Workers(I),
                        Age    => Today.Year - DoB.Year );
        end if;
    end ;
end loop;

Older Ada programmers will be familiar with rename constructs such as:

with P1;
function "+" (Left, Right : P1.MY_INTEGER) 
                     return P1.MY_INTEGER renames P1."+";

which were necessary to gain visibility of the operator for MY_INTEGER from package P1 in the absence of a use clause. The alternative was the extremely cumbersome:

Var := P1.”+” ( Var1, Var2);

They will also painfully remember the following error when adding extra operators in to code:

function "+" (Left, Right : P1.MY_INTEGER) 
                     return P1.MY_INTEGER renames P1."+";
function "*" (Left, Right : P1.MY_INTEGER) 
                     return P1.MY_INTEGER renames P1."+";

The multiply operator has been added by cut and paste but the rename is still of the “+” operator. Fortunately Ada 95 has pragmatically implemented the “use type” clause, thus:

with P1;
use type P1.MY_INTEGER;

will give visibility to all the primitive operators associated with MY_INTEGER, while the types and objects still need disambiguation, there is no doubt where the operators are inherited from.

The rename facility of the Ada language gives a useful shorthand notation for accessing objects. Judgment must be used when to use this feature – the above examples are all fairly trivial; real world instances are likely to have more benefit. In conclusion it can be seen that renames can significantly enhance readability while at the same time retain traceability and avoid the need for use clauses.

DO-178C webinars

DO178C webinars

White papers

Mitigation of interference in multicore processors for A(M)C 20-193
Sysgo WP Developing DO-178C and ED-12C-certifiable multicore software
DO178C Handbook Efficient Verification Through the DO-178C Life Cycle
A Commercial Solution for Safety-Critical Multicore Timing Analysis

Related blog posts

Evolving language support in RVS: Libadalang

.
2020-04-09

Test your Ada skills with our puzzle

.
2019-06-18

Highlights from Ada-Europe 2018

.
2018-07-03

Highlights from Ada Europe 2016

.
2016-07-06

Pagination

  • Current page 1
  • Page 2
  • Page 3
  • Page 4
  • Page 5
  • Next page Next ›
  • Last page Last »
  • Solutions
    • Rapita Verification Suite
    • RapiTest
    • RapiCover
    • RapiTime
    • RapiTask
    • MACH178

    • Verification and Validation Services
    • Qualification
    • Training
    • Integration
  • Latest
  • Latest menu

    • News
    • Blog
    • Events
    • Videos
  • Downloads
  • Downloads menu

    • Brochures
    • Webinars
    • White Papers
    • Case Studies
    • Product briefs
    • Technical notes
    • Software licensing
  • Company
  • Company menu

    • About Rapita
    • Careers
    • Customers
    • Distributors
    • Industries
    • Locations
    • Partners
    • Research projects
    • Contact
  • Discover
    • Multicore Timing Analysis
    • Embedded Software Testing Tools
    • Worst Case Execution Time
    • WCET Tools
    • Code coverage for Ada, C & C++
    • MC/DC Coverage
    • Verifying additional code for DO-178C
    • Timing analysis (WCET) & Code coverage for MATLAB® Simulink®
    • Data Coupling & Control Coupling
    • Aerospace Software Testing
    • Automotive Software Testing
    • Certifying eVTOL
    • DO-178C
    • AC 20-193 and AMC 20-193
    • ISO 26262
    • What is CAST-32A?

All materials © Rapita Systems Ltd. 2025 - All rights reserved | Privacy information | Trademark notice Subscribe to our newsletter