!ASIS Issue #004 !topic Environment Model for ASIS95 !reference ASIS95-ENV !from S. Rybin 95-03-08 !keywords Library !discussion The following message was submitted by S. Rybin to asiswg-technical. At the March 1995 ASISWG meeting, the issues were discussed and believed to be important to address and resolve at the next meeting. Additional interfaces in the ENVIRONMENT package may be required. From alex!alex.srcc.msu.su!rybin@srcc.msu.su Thu Feb 16 10:23:44 1995 Return-Path: To: asiswg-technical@sw-eng.falls-church.va.us Cc: alfred.strohmeier@di.epfl.ch Organization: Research Compiting Center, Moscow State University From: Rybin Sergey Igorevich Date: Thu, 16 Feb 95 17:24:20 +0300 Subject: Comment on ASIS 2.0.A Drafts: ASIS library model Lines: 264 Content-Length: 13791 X-Lines: 264 Status: RO Dear colleagues, may be, this comment on the ASIS 2.* Drafts available by now is too premature (the Proposed ASIS 9X Version 2.0.A -- Jan 1995 explicitly says that: "This proposal covers only the changes dealing with elements. Changes to the Asis.Compilation_Units package will be addressed in a separate proposal; these changes appear so far to be minor." If so - please, skip my comment and accept mu excuses :-). But I am really puzzled by the fact that all documents related to the ASIS 2.0.A says that changes to the Asis.Compilation_Units package appear so far to be minor, and the Asis.Libraries package do not need any changes at all. ASIS 1.1.1 Detailed Semantics and Implementation says, that the ASIS notion of Library is one of the basic ASIS abstractions, and that "ASIS Libraries are intended to exactly match the concept of the same name from the Ada LRM(83) section 10.4". But LRM_95_ does not define the notion of Ada program library at all! LRM95 contains only one statement concerning library, and this statement is rather informal (10(2): "An implementation may (not *must* or *should* !) support a concept of a program library (or simply, a "library"), which contains library_items") LRM83 contains rather strict definitions of the order of compilation, compilation dependencies, rules for turning the compilation units included in the library in the obsolete state. And the corresponding ASIS 1.1.1 notions, queries and documentation from the Asis.Compilation_Units package closely correspond to the LRM83 Library model. But in LRM95 we have much more loose description of (much?) more loose Library model: we have environment instead of library, the requirement of presence in the environment instead of the requirement of having been successfully compiled for the library units upon which the given unit being compiled depends semantically, and we do not have the notion of obsolete unit at all! But we have the notion (/) of the version of a compilation unit in LRM95! And ASIS 2.* Drafts say about only minor changes in ASIS Library model!? I tried to initiate the discussion concerning new Ada library model (or new definition of Ada Library model) and, in particular the way of defining the ASIS-1.1.1-like Library for the GNAT compilation model in the context of our ASIS-for-GNAT project, but Alfred Strohmeier and Robert Dewar terminated this discussion very quickly by assertion that there is no serious differences between Ada83 and Ada95 Library models in their nature. I was (an I am now) ready to agree with this assertion as concerning to the nature of the Library models, but both LRM95 and ASIS 2.* are to be rather formal systems, so not only nature (essence) of the Library models, but also the formal ways of their definitions seem to be important. During the Ada9X revision process I prepared a special comment on the definition of the new Ada library and compilation models in the version 5.0 of RM9X. I repeat this comment (without any changes, because the final version of the section 10 in LRM95 contains only minor changes in relation to RM9X 5.0) as the annex to this letter. With best regards, Serge Rybin, Moscow University, ASIs-for-GNAT project. =================================================================== !topic completeness and accuracy of new (relaxed) library model !reference RM9X-10;5.0 !reference RM9X-10.1;5.0 !reference RM9X-10.1.1;5.0 !reference RM9X-10.1.4;5.0 !reference RM9X-10.2;5.0 !from Sergei Rybin !keywords separate compilation, program, partitions, program library !discussion I have tried to summarize in this comment the general impression which I received from Section 10 of the RM9X;5.0 and to find and systematize general reasons for some discomfort which I got after studying this section. ( I sent some concrete comments for Section two weeks ago.) I began learning and studying of the version 5.0 from Section 10 because of special interest to library and compilation issues of Ada 9X arisen from my participance in the small (in its current state) research project aimed at implementation of ASIS for GNAT - now we are in the beginning of design stage of the project, and one of our main problems is how to define ASIS-1.1.1-based notion of Ada Library for GNAT. Of course, I completely understand, that there is no time for detailed discussion, changing and editing both of the essence of the new Ada compilation model and of general structure of its description in the RM9X. Moreover, after studying "A Library Design For GNAT" Document I see that you have enough reasons for relaxing requirements defining Ada compilation model, and I see how this Document may be used as a part of justification and rationale for the new model. But from the other side, I could not keep myself from writing and sending of this comment. This comment does not touch upon any aspects of child units and library-level renaming. It concerns only general principles of the new compilation model and of the description of this model. It also concerns the core language only. 1. The First Surprise - Library Unit without Library? The notion of PROGRAM LIBRARY has been removed from the normative part of the (new) Ada standard, but notions (and corresponding terms) of LIBRARY_item and LIBRARY_unit are used extensively in Section 10. Such RM83-like wording is clear and convenient enough for most "old" Ada-people (they have a lot of other changes to learn and to get used to), but how it may seem to novices? 2. Trying to bridge a gap between old and new Ada compilation models. For the first look the new Ada compilation model seems as being rather different from the old model. Finding common features with the old (RM83-defined) model and retracing evolution avenues of the Ada compilation model may be considered by some readers as useful means of studying and perceiving of the new model. Moreover, retracing of the avenues of the compilation model evolution may be used as a part of Rationale for Section 10. I have represented the following picture for myself: 1. Environment-9X is a weakened analog of the Program Library-83. (By the way, is "environment" a completely new NOTION or is it only a new WORDING for old but modified notion? I am inclined to the second version.) What would RM9x lose if the term (notion?) "environment" would be changed (back?) to "program library"? Or, if we use the notion of "environment" (instead of library?), it would be more natural to describe the Ada9X compilation model in terms of environment_item and environment_unit. Moreover, prefix "compilation" for "unit" in Ada83 reflects the fact that a COMPILATION_unit" may be included in the LIBRARY only after successful compilation of the unit. But in Ada 9X a COMPILATION_unit may be included in the ENVIRONMENT by some implementation-defined manner that does not require any COMPILATION of the unit. 2. The last sentence of previous paragraph should be mentioned by itself as an important difference between Ada 83 and Ada 9X compilation models: inclusion of any library unit in an environment is not connected in the new model with the fact of successful compilation of the unit. (The situation with subunits in Ada 9X is not completely clear for me.) 3. Well-defined "compilation_unit_dependencies" as a means of controlling the compilation process is replaced by much more vague "existing_in_an_environment_dependencies" (10.1.4(5)), which has similar intent. The main problem is that RM9X says really nothing about what does it mean "the compilation unit exist in the environment". RM9X allows to compile a body before compiling of the corresponding specification provided that the specification exists in the environment. Suppose that we have placed in the environment some specification containing errors defined as compile-time in 1.1.5(2-3), and after that we compile the corresponding body which does not contain such errors on its own. How must the compiler treat such body (in the sense of 1.1.3(4))? And can we say about LEGAL body for ILLEGAL specification? 4. I could not find any analogues for notions of recompilation (may be, reinclusion in the environment) and "to be (or to become) obsolete" (may be, to be forced to leave the environment) for Ada 9X compilation units. Instead of these notions we have only general requirement: "...the set of these compilation units shall be _consistent_ in the sense that the new compilation unit shall not semantically depend (directly or indirectly) on two different versions of the same compilation unit, nor on an earlier version of itself." (10.1.4(5). But what does "version(s) of a compilation unit" mean? How can two or more versions of the same unit be simultaneously included in the same environment if any two library units are required to have distinct names? Does the changing of version of the compilation unit mean that the unit must be first excluded from the environment and then included in it in some different state? If it does, how must we treat the first part of 10.1.4(5)? In particular, suppose that some compilation unit was successfully compiled, and after that some other unit upon which our unit depends semantically, was excluded from the environment. What must (may?) happen with our unit? Does the second part of 10.1.4 give the answer? 5. If we consider the new Ada compilation model, we must consider the notion of partition. I prepared a special comment concerning partitions (key 94-4599.g), and I can not say any more about it. May be, it is not quite correct to consider Ada 9X compilation model from the point of view of Ada 83 program library. I am afraid I have been thinking in such a way in this point of the comment. The question is: how typical would such point of view be among RM9X readers? 3. Ada 9X compilation model - is it "a forced marriage" of Ada 83 program library and GNAT library model? I had come to know the GNAT library model before I began to study in details new Ada compilation model, and this circumstance helped me very much in understanding of the new compilation model. I have been using GNAT as a "proof of existence" and "A Library Design For GNAT" document as additional AARM's and Rationale's parts. Of course, it is only my interpretation, but the new model seems to me as some kind of "marriage" between the old Ada 83 program library and GNAT "library". But this "marriage" does not look as successful enough - both partners have lost some important properties. Old library model lost too many of its strictness, and GNAT model lost the idea of object-to-sources dependence. The idea of object-to-source dependencies is a very smart invention of the GNAT project - it allows to answer various questions concerning the order and legality of compilation (some of them are formulated in the previous point of this comment) and it imposes no additional restrictions on RM9X-defined compilation model. This point of the comment may be reformulated without direct reference to the GNAT model. What do you think about the idea to include notions of "source" (as some abstraction or invariant of a source file or any other "origin" corresponding to a compilation unit) and "object" (as some abstraction or invariant of a "final" result of the compilation of a compilation unit) in the set of notions used for descriptions of Ada 9X compilation model. The notion of "source" may be used to define the notions of existence of a compilation unit in the environment, and of versions of compilation units: and some GNAT-like, but, may be, more general object-to-source dependencies may be used to define the compilation process. Of course, at least three variants of the definition of the notion of "source" are required - for predefined units, for units developed in the environment, and for units imported from outside the environment (GNAT does not solve the problem of hidden-source export and import). But in any case, the notion of source (file, text or something else) may be considered as being closely related to the notion of compilation (or library) unit and to the compilation process. Moreover, AARM says that RM9X is intended to promote portability of Ada programs at the SOURCE LEVEL (AARM-10(2.a);4.0). So, it would be quite natural to use the notion of source in the definition of Ada9X compilation model. 4. Is it possible to make Ada 9X compilation model more precise without making it more restrictive? This question is not completely clear for me now. I suppose it would be possible, and introduction of "source-to-object", "source-to-environment" and "source-to-version" dependencies may be considered as one of the ways to do this. May be, other ways are possible. ----------------------------------------------------------------- Of course, I recognize, that you have serious reasons to define and to describe Ada 9X compilation model as it has been described in Section 10 of the RM9X;5.0. But I am afraid that Ada 9X may find herself too close by her best "friend" C/C++ in this aspect. I hope you will excuse me for such long, muddled and too emotional comment. And I am awfully sorry for my English! !resolution Accepted. !date 95-06-27 !Notes This general environment model for ASIS 95 was accepted and included in ASIS 2.0.D.