From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,56dbd715fa74735a X-Google-Attributes: gid103376,public From: fjh@cs.mu.oz.au (Fergus Henderson) Subject: Re: Mutually dependent private types Date: 1998/05/30 Message-ID: <6kp02d$of5$1@mulga.cs.mu.OZ.AU>#1/1 X-Deja-AN: 357923896 References: <6k25ra$6j7$1@nnrp1.dejanews.com> <3565B105.9BFB4788@ac3i.dseg.ti.com> <356B226F.EF05E927@ac3i.dseg.ti.com> <356C8A02.44354B09@ac3i.dseg.ti.com> <356E09A1.B493FE89@ac3i.dseg.ti.com> <356F8561.A863216A@acenet.com.au> Organization: Computer Science, The University of Melbourne Newsgroups: comp.lang.ada Date: 1998-05-30T00:00:00+00:00 List-Id: Geoff Bull writes: >How does a compiler that uses a non source based compilation library >"with" a package that hasn't been compiled yet? >(i.e. would allowing circular dependencies introduce a big headache >for just about every Ada compiler, except for Gnat?) You can implement this by breaking up "compilation" into several stages. For example, the Mercury compiler (which supports a module system similar to that of Ada) supports circular dependencies with a non-source-based compilation library by breaking compilation into the following stages: mmc --make-short-interface foo Does rudimentary syntax checking. Records the names of types defined in the module foo in the compilation database. Preconditions: none. mmc --make-interface foo Checks the interface for type correctness (i.e. checks that there are no undefined types, etc.). Records the interface of module foo in the compilation database. Preconditions: the "short interfaces" of all imported modules must have already been generated. mmc --compile foo Does full semantic checking. Generates object code for the module foo. Preconditions: the interfaces of all imported modules must have already been generated. Actually our "compilation database" is just a subdirectory containing plain ASCII files. The above preconditions are recorded in dependency files, and then we use a tool based on GNU Make to ensure that the compiler is invoked with the appropriate options in the appropriate order. Whether or not doing this kind of thing would be a "big headache" for existing Ada compilers is another question -- that would depend a lot on exactly how they were implemented. But I thought that the other Ada95 front-ends all used the same kind of source based model that GNAT uses anyway. -- Fergus Henderson | "I have always known that the pursuit WWW: | of excellence is a lethal habit" PGP: finger fjh@128.250.37.3 | -- the last words of T. S. Garp.