Structured programming with limited private types in Ada: nesting if for the soaring eagles

  • Authors:
  • Henry G. Baker

  • Affiliations:
  • Nimble Computer Corporation, 16231 Meadow Ridge Way, Encino, CA

  • Venue:
  • ACM SIGAda Ada Letters
  • Year:
  • 1991

Quantified Score

Hi-index 0.00

Visualization

Abstract

Many traditional styles of programming cannot cope with the limitations of Ada limited private types. We present a style of programming that enables structured programming in Ada with limited private types. The problem of "finalization" is safely and cleanly handled through the use of a generic package which guarantees that a variable of the limited private type will be finalized even in the presence of exceptions.Finalization is often desired in order to perform automatic garbage collection, whether by reference counting or by marking. We have proved our structured technique by developing a garbage-collected Lisp system in Ada in which the Lisp values are instances of a limited private type. The Ada code was so highly structured, that it was generated automatically using a simple compiler. The garbage collector in this system was easily and safely implemented, and different garbage collection techniques were tested without affecting user code.