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,6161bc9aa025a9a3,start X-Google-Attributes: gid103376,public From: stt@henning.camb.inmet.com (Tucker Taft) Subject: Subunits of packages vs. subunits of subprograms Date: 1996/07/11 Message-ID: #1/1 X-Deja-AN: 167820824 sender: news@inmet.camb.inmet.com (USENET news) x-nntp-posting-host: henning.camb.inmet.com organization: Intermetrics, Inc. keywords: separate, subunit, stub newsgroups: comp.lang.ada Date: 1996-07-11T00:00:00+00:00 List-Id: [NOTE: This is a continuation of the discussion of subunits, but I couldn't bear to see "separate" misspelled yet again. I would think that Ada programmers, of all people, would know that "separate" has two "a"s. Perhaps the misspelling just proves that subunits are no longer being used as much in Ada 95 ;-).] In any case, our AdaMagic(tm) front end implements the approach Robert mentions, namely that subunits nested only in packages are "truly" separately compiled, whereas subunits nested in any non-package are "inlined" at the point of the stub. If the subunit is not available when this "inlining" would take place, we issue a warning that the enclosing unit will need to be recompiled when the subunit is available. We don't consider this an error, and the (pre)linker will by default perform the needed recompilation if necessary. Interestingly, when we retargeted AdaMagic to generate Java byte codes (our "AppletMagic(r)" product), we had to shift to fully "inlining" all subunits, as well as generating code for package specs only when encountering the package body (presuming there is one). This was necessary because, given our Ada => Java mapping, all code for a single Ada package needs to be in the same Java ".class" file. In fact, the whole source->object model breaks down a bit with Java byte codes, because Java "object modules" (.class files) are required to be one-to-one with Java classes, which relate to Ada entities, not to Ada source files. So our front end now supports both approaches, fully "inlined" subunits, and separate compilation of package-enclosed subunits, depending on the target. -Tucker Taft stt@inmet.com http://www.inmet.com/~stt/ Intermetrics, Inc. Cambridge, MA USA