[net.lang.ada] Mutually Recursive Data-Structures in Ahis on csnet a couple of times a

Mats_Ohlin_FOA2%QZCOM.MAILNET@MIT-MULTICS.ARPA (09/21/85)

This is how it works (on a DEC-10 system):
.;---------------------------
.;create module 1
.make a1.sim
*ioptions(/E);          -- tells the compiler that this is an ext. module
class a1;
begin  ref (b1) bx;  end a1;
$ex$$

.comp a1.sim           -- compile module 1
SIMULA:  A1
begin  ref (b1) bx;  end a1;
SIM331  E LINE     3     QUALIFICATION b1 IS NOT A CLASS  -- b1 is unknown

.; create module 2, now including external decl.
.make b1.sim
*ioptions(/E);
external class a1;      -- now OK since A1.ATR exists, however uncomplete
class b1;
begin  ref (a1) ax;  end b1;
$ex$$

.dir/n ?1
A1      SIM     1  <057>   20-Sep-85    A1      ATR     1  <057>   20-Sep-85
A1      REL     1  <057>   20-Sep-85    B1      SIM     1  <057>   20-Sep-85

.com b1.sim            -- compile module 2
SIMULA:  B1

EXIT

.te a1.sim
*liexternal class b1;           -- add external decl.
$ht$$
options(/E);
external class b1;
class a1;
begin  ref (b1) bx;  end a1;
*ex$$

.com a1.sim            -- recompile module 1 using correct B1.ATR
SIMULA:  A1

NEW ATR FILE GENERATED          -- compiler warns user
RECOMPILE DEPENDENT PROGRAMS    -- that recompilation may be necessary

EXIT

.com/com b1.sim
SIMULA:  B1

NEW ATR FILE GENERATED

EXIT

.dir/n ?1
A1      BAK     1  <057>   20-Sep-85    A1      QTR     1  <057>   20-Sep-85
A1      REL     1  <057>   20-Sep-85    B1      SIM     1  <057>   20-Sep-85
B1      QTR     1  <057>   20-Sep-85    B1      REL     1  <057>   20-Sep-85
A1      SIM     1  <057>   20-Sep-85    A1      ATR     1  <057>   20-Sep-85
B1      ATR     1  <057>   20-Sep-85

.;--- QTR files are backup versions of created ATR files
.;--- *very* useful whenever you find that you would rather
.;--- backtrack than force everyone (dependent) to recompile...

Mats_Ohlin_FOA2%QZCOM.MAILNET@MIT-MULTICS.ARPA (09/21/85)

This problem is well known in other languages, e.g. SIMULA.
The problem is not covered in the language definition, however
at least some systems allow the user to compile the first unit
in which the compilation fails *but still generates some attribute
information /used by the compiler when compiling dependent modules/*.
This first compilation then lacks the necessary EXTERNAL declaration
(==> module 2).
Then compiling module 2 is possible even if it is referring to
an uncomplete definition of module 1. Recompiling module 1, this
time including the EXTERNAL declaration, recompiling module 2
and finally recompiling module 1 solves the problem. Cumbersome
maybe, but it works and with full security.