Jacob Sparre Andersen Articles


Declaring subtypes of private types

Sometimes, you want to declare a subtype for a subset of the possible values of a private type. You might for example want a subtype of Ada.Calendar.Time, which only can include times in the past. If Ada.Calendar.Time was a numeric type, we could declare a subset …

Building a VCS status package with Gprbuild

Would you like your executable files to be able to tell which commit in your version control system it corresponds to? You can do it by: Creating a program (in this example a shell script), which generates Ada source files reporting the version control status. Defining a "language" in Gprbuild …


Self-referencing Objects

One may in some cases want an object to contain a reference ('Access) to itself. The package Self_Referencing_Objects shows how one can implement (consistently) self-referencing objects using limited records and discriminants. type Instance is limited private; ... type Holder (Reference : access Instance) is limited null record; type Instance is limited record …