From rybin@alex.srcc.msu.su Wed Sep 18 08:19:51 1996 Return-Path: Received: from ida.org by csed-115.csed.ida.org (SMI-8.6/SMI-SVR4) id IAA12122; Wed, 18 Sep 1996 08:19:46 -0400 Received: from sw-eng.falls-church.va.us (ns1.sw-eng.falls-church.va.us) by ida.org (4.1/SMI-4.1) id AA12658; Wed, 18 Sep 96 08:19:03 EDT Received: from gw.srcc.msu.su by sw-eng.falls-church.va.us (8.7.1/) id MAA16832; Wed, 18 Sep 1996 12:04:44 GMT Received: from srcc.UUCP (uusrcc@localhost) by gw.srcc.msu.su (8.6.12/8.6.12) with UUCP id QAA09435; Wed, 18 Sep 1996 16:04:51 +0400 Received: by gamma.srcc.msu.su; Wed, 18 Sep 1996 16:04:00 +0400 Received: by vadik.srcc.msu.su; Wed, 18 Sep 1996 16:01:22 +0400 Received: by alex.srcc.msu.su (UUPC/@ v5.09gamma, 14Mar93); Wed, 18 Sep 1996 16:04:57 +0400 To: asis-officers@sw-eng.falls-church.va.us Cc: alfred.strohmeier@di.epfl.ch, dewar.gnat.com@gw.srcc.msu.su Message-Id: Organization: Research Computing Center, Moscow State University From: Rybin Sergey Igorevich Date: Wed, 18 Sep 96 16:04:57 +0400 X-Mailer: BML [MS/DOS Beauty Mail v.1.36] Subject: Inconsistent unit subsets in ASIS 95 Lines: 146 Content-Length: 6623 Status: OR ASIS-for-GNAT is not a source-based system any more, so now I have all the problems with inconsistencies among ASIS Compilation Units as any other ASIS implementer :-) After coming to the implementation of some semantic queries for Compilation Units I have found myself in trouble with the interpretation of the current ASIS 95 definition for processing inconsistent unit sets. Consider the following events taking place in the same environment: 1. The package P is compiled. 2. Its child package P.Q is compiled. 3. The *procedure body* P is compiled (the package P is removed from the environment, if it is necessary to make the compilation of the procedure P legal, but P.Q *is not removed*). What we have in the ASIS Context representing this environment? What should be returned as a result of the Compilation_Units query? The answer should be: the result should contain units having names P and P.Q (P.Q is inconsistent with P, P is of A_Procedure_Body kind, and P.Q is of A_Package kind)). Next question: what should be for this Context the result of the query Corresponding_Parent_Declaration, if the arguments represents the (child) package P.Q? It cannot be P, because ASIS says, that a result of Corresponding_Parent_Declaration may be one of the following kinds: -- Not_A_Unit -- A_Package -- A_Generic_Package -- A_Package_Instance -- A_Nonexistent_Declaration -- An_Unknown_Unit It also cannot be a unit of A_Nonexistent_Declaration kind, because units of this kind have (Ada) names, and the question is - what will be the result of the Name query applied to such a Nonexistent unit? It cannot be "P", because the Context already contains the unit of A_Procedure_Body kind having "P" as its Ada name, and for any full expanded Ada name an ASIS Context may contain at most one ASIS Compilation Unit having this name. It also cannot be Not_A_Unit, because a Nil_Compilation_Unit may be returned by this query only for Standard. The last possibility is to raise an exception. Obsolete_Reference_Error is fine for error kind to be set, but the question is - what exception should be raised? Asis_Failed seems to be the only possible candidate, but it is defined as: Asis_Failed : exception; ------------------------------------------------------------------------------ -- All ASIS routines may raise Failed whenever they cannot normally complete -- their operation. This exception will typically indicate a failure of the -- underlying ASIS implementation. -- -- This is a catch-all exception that may be raised for different reasons -- in different ASIS implementations. ------------------------------------------------------------------------------ It would be nice to have a special exception for the situations like described above (similar example may be provided for subunits and the Corresponding_Subunit_Parent_Body query), because Asis_Failed looks "too general", and the situation does not look like "a failure of the underlying ASIS implementation". This example may be generalized like this: consider the following sequences of the events taking place in the same environment: 1. The package P is compiled. 2. Its child package P.Q is compiled 3. Its child P.Q.R is compiled. 4. Its child P.Q.R.S is compiled. 5. P.Q.R is recompiled as a child *procedure* of P.Q. And now two questions (supposing we are querying about the semantic dependencies for P.Q.R.S by using the Semantic_Dependence_Order query): (1) What should be the result if we ask about *Ancestors* for P.Q.R.S? (2) What should be result if we ask about *Supporters* for P.Q.R.S? What would make more sense for the first situation - to return the result containing

, and as consistent unit list and ... and what else .... as an inconsistent unit list or to raise an exception (Asis_Failed?) with setting Obsolete_Reference_Error error status? For sure, for the second situation no exception should be raised, but should the result contain all the supporters of the *procedure* P.Q.R, which may have no relation to the obsolete package P.Q.S? (It seems that it should...) CONCLUSION AND SUGGESTION. ========================= 1. ASIS is ill-defined for the situations when ASIS should process inconsistent unit sets (there are two kinds of these situations: semantic dependencies between compilation units, and semantic queries for elements, when the enclosing unit of the argument element is inconsistent with the enclosing unit of the result argument. During the technical discussion at the next to last ASISWG meeting in Florida we agreed, that Asis_Failed should be raised for the second situation - it would be nice to have this statement in the ASIS definition). The only statement related to processing inconsistent unit sets I have found in ASIS 95 is (just preceding the Semantic_Dependence_Order query in the Asis.Compilation_Units package): --|AN Application Note: --|AN --|AN To properly determine unit consistency, use one of the two semantic --|AN dependence queries: Elaboration_Order or Semantic_Dependence_Order. --|AN These queries return a value of the type Relationship, which contains --|AN lists of consistent, inconsistent, missing and circular units. --|AN --|AN For these two queries, the existence of units in one or more of the --|AN inconsistent, missing, or circular units list means that the consistent --|AN unit list may not be complete. --|AN --|AN Applications that do not check for inconsistent, missing, or circular --|AN units before using the consistent list might not operate as expected. --|AN Have I missed something important? If I have not, I would say, that it is too general and should be said in some more details. 2. I would suggest to add a new exception to the existing set of the ASIS exceptions (Asis_Inconsistent_Unit_Set??) for the situation when ASIS cannot provide any meaningful answer for a query because of some inconsistency between units needed to be accessed when processing the query. I would also explicitly indicate the situations when this exception may (should?) be raised. I think, the example with the Corresponding_Parent_Declaration query is on of such situations. Sergey. P.S. Do you think it would make sense to move the discussion about this problem to ASIS or ASIS-Technical forum? If it would make sense, and if this message is OK to start the discussion, Clyde, could you forward it to ASIS/ASIS-Technical. Now I came to my office two-three times a week to check my mail... From Alfred.Strohmeier@di.epfl.ch Wed Oct 9 06:47:23 1996 Return-Path: Received: from ida.org by csed-115.csed.ida.org (SMI-8.6/SMI-SVR4) id GAA04920; Wed, 9 Oct 1996 06:46:57 -0400 Received: from sw-eng.falls-church.va.us (ns1.sw-eng.falls-church.va.us) by ida.org (4.1/SMI-4.1) id AA12303; Wed, 9 Oct 96 06:45:00 EDT Received: from wormhole.mtc.iitri.com by sw-eng.falls-church.va.us (8.7.1/) id KAA16163; Wed, 9 Oct 1996 10:26:19 GMT Received: from sicmail.epfl.ch by mtc.iitri.com (4.1/3.1.090690-IITRI-MTC) id AA11343; Wed, 9 Oct 96 06:25:08 EDT Received: from lglsun7.epfl.ch by sicmail.epfl.ch with SMTP (PP); Wed, 9 Oct 1996 12:03:52 +0200 Received: by lglsun7.epfl.ch (5.x/Epfl-4.11-c/MX) id AA18356; Wed, 9 Oct 1996 11:11:42 +0100 Date: Wed, 9 Oct 1996 11:11:42 +0100 From: Alfred.Strohmeier@di.epfl.ch (Alfred Strohmeier) Message-Id: <9610091011.AA18356@lglsun7.epfl.ch> To: asis-officers@sw-eng.falls-church.va.us, rybin@alex.srcc.msu.su Subject: Re: Inconsistent unit subsets in ASIS 95 Cc: dewar.gnat.com@gw.srcc.msu.su X-Sun-Charset: US-ASCII Content-Length: 2033 Status: OR > From rybin@gamma.srcc.msu.su@alex@alex.srcc.msu.su Wed Sep 18 14:19:38 1996 > To: asis-officers@sw-eng.falls-church.va.us > Cc: alfred.strohmeier@di.epfl.ch, dewar.gnat.com@gw.srcc.msu.su > Organization: Research Computing Center, Moscow State University > From: Rybin Sergey Igorevich > Date: Wed, 18 Sep 96 16:04:57 +0400 > Subject: Inconsistent unit subsets in ASIS 95 > Lines: 146 > > ASIS-for-GNAT is not a source-based system any more, so now I have all > the problems with inconsistencies among ASIS Compilation Units as any > other ASIS implementer :-) > > After coming to the implementation of some semantic queries for Compilation > Units I have found myself in trouble with the interpretation of the current > ASIS 95 definition for processing inconsistent unit sets. > > Consider the following events taking place in the same environment: > > 1. The package P is compiled. > > 2. Its child package P.Q is compiled. > > 3. The *procedure body* P is compiled (the package P is removed from > the environment, if it is necessary to make the compilation of the > procedure P legal, but P.Q *is not removed*). > > What we have in the ASIS Context representing this environment? > What should be returned as a result of the Compilation_Units query? > The answer should be: the result should contain units having names P > and P.Q (P.Q is inconsistent with P, P is of A_Procedure_Body kind, and > P.Q is of A_Package kind)). In my opinion, the ASIS Context should only contain P of A_Procedure_Body kind. Maybe that some ASIS implementations will/could keep in mind that there WAS a P.Q of of A_Package kind, but it would be marked as obsolescent, and any access to its content by a subsequent ASIS query should fail. I come to this conclusion by reasoning in terms of the language. It seems to me impossible, to have any sensible discussion about P.Q when P is not available (i.e., is undefined). > > Sergey. > My remark comes late, perhaps too late, but I was too busy. Alfred From rybin@alex.srcc.msu.su Tue Oct 1 04:49:27 1996 Return-Path: Received: from ida.org by csed-115.csed.ida.org (SMI-8.6/SMI-SVR4) id EAA19686; Tue, 1 Oct 1996 04:49:21 -0400 Received: from sw-eng.falls-church.va.us (ns1.sw-eng.falls-church.va.us) by ida.org (4.1/SMI-4.1) id AA18540; Tue, 1 Oct 96 04:48:21 EDT Received: from crocus.gamma.ru by sw-eng.falls-church.va.us (8.7.1/) id IAA15597; Tue, 1 Oct 1996 08:06:10 GMT Received: from srcc.UUCP (uucp@localhost) by crocus.gamma.ru (8.7.6/8.7.3) with UUCP id MAA11499; Tue, 1 Oct 1996 12:08:09 +0400 (MSD) Received: by gamma.srcc.msu.su; Tue, 1 Oct 1996 12:07:00 +0400 Received: by vadik.srcc.msu.su; Tue, 1 Oct 1996 12:06:16 +0400 Received: by alex.srcc.msu.su (UUPC/@ v5.09gamma, 14Mar93); Tue, 1 Oct 1996 11:44:14 +0300 To: sblake@alsys.com Cc: asis-technical@sw-eng.falls-church.va.us References: <9610010111.AA19960@pulsar.telesoft> Message-Id: Organization: Research Computing Center, Moscow State University From: Rybin Sergey Igorevich Date: Tue, 1 Oct 96 11:44:13 +0400 X-Mailer: BML [MS/DOS Beauty Mail v.1.36] Subject: Processing inconsistent unit sets in ASIS 95 Lines: 295 Content-Length: 12833 Status: OR Steve, Thanks for your explanations concerning processing inconsistent unit sets - now the picture in my mind is much clearer, and in this message I try to make some conclusions. I send the copy of it to asis-technical, so I append some part of our previous discussions. Sergey. ------------------------------------------------------------------- There are three kind of semantic queries in ASIS - semantic queries about Elements; semantic queries about Compilation Units, the names of these queries start from "Corresponding_", the Subunits query is also of this kind (why don't "Corresponding_Subunits?); and the last group consists of two queries - Semantic_Dependence_Order and Elaboration_Order. All these queries may be in the situation, when some inconsistent subset of Compilation Units is processed during query processing. Processing of inconsistent unit sets is in a certain extent implementation-dependent, but it would be nice to have some general lows stated as a part of the ASIS definition. Below there is an attempt to suggest such rules: 1. Semantic queries about Elements. ------------------------------- If Enclosing_Compilation_Unit of the argument is inconsistent with the Compilation_Unit, which should be Enclosing_Compilation_Unit for the result Element of the query, Asis_Failed should be raised, and Obsolete_Reference_Error error status should be set. (Should or may?) 2. Semantic queries about Compilation_Units (other then ---------------------------------------------------- Semantic_Dependence_Order and Elaboration_Order) ------------------------------------------------ Corresponding_Children: If the declaration of a child is inconsistent with the argument of the query, neither declaration nor body is returned. If the declaration of a child is consistent with the argument, but the body is not, the declaration is returned, and for the body, the result of the Corresponding_Body query applied to the declaration is returned. Corresponding_Parent_Declaration: I agree with your explanation: if a parent is inconsistent with a child passed as the argument, A_Nonexistent_Declaration should be returned. Corresponding_Declaration: The rule should be the same as for Corresponding_Parent_Declaration: if the declaration of an argument Element is inconsistent with the argument, A_Nonexistent_Declaration should be returned. (For a unit A_Procedure_Body or A_Function_Body kind the solution may be in any case to return Nil_Unit if the unit is of A_Public_Declaration_And_Body kind.) Corresponding_Body: If the argument Element requites a body to be presented to make up a complete partition containing this Element, but the Context does not contain the corresponding body, or the body contained in the Context is inconsistent with the argument Element, A_Nonexistent_Body should be returned. Subunits: If a subunit is absent or if it is inconsistent with the argument Element, A_Nonexistent_Body should be returned for it. Corresponding_Subunit_Parent_Body: Same as for Corresponding_Parent_Declaration and Corresponding_Declaration: A_Nonexistent_Body should be returned, if the corresponding body does not exist in the Context, or if it exists, but is inconsistent with the argument Element. (P.S. to point 2: these suggestions also change some aspects related to processing/returning inconsistent units by these queries). 3. Semantic_Dependence_Order ------------------------- The main idea is that this query should never raise an exception when processing inconsistent unit (sub)sets. The justification for this decision is that this query is the only means for an application to get to know if a given unit is consistent with (some of) its supporters (dependents), and therefore the related semantic processing can give the valuable results for this unit. I don't think, that this is a good thing, if for some situations when inconsistent unit (sub)sets have to be processed, this query forms the list of inconsistent units as a part of the returned Relationship value, and for some other situations Asis_Failed is raised. If we agree on this principle, I think, it would be possible to define rules how to form the parts of the Relationship value returned by this query for any inconsistent unit sets, including situations (which may be really crazy, but the appearances of such situations are not under the control of an ASIS implementation!), when something is recompiled (changed in an environment) in the middle of the dependency chain for a given unit. -------------- below is a part of the previous discussion: -------------- -------------- my initial text is marked by the traditional -------------- -------------- ">" prefix, Steve's reply has no prefix, -------------- >After coming to the implementation of some semantic queries for Compilation >Units I have found myself in trouble with the interpretation of the current >ASIS 95 definition for processing inconsistent unit sets. > >Consider the following events taking place in the same environment: > >1. The package P is compiled. > >2. Its child package P.Q is compiled. > >3. The *procedure body* P is compiled (the package P is removed from > the environment, if it is necessary to make the compilation of the > procedure P legal, but P.Q *is not removed*). > >What we have in the ASIS Context representing this environment? >What should be returned as a result of the Compilation_Units query? >The answer should be: the result should contain units having names P >and P.Q (P.Q is inconsistent with P, P is of A_Procedure_Body kind, and >P.Q is of A_Package kind)). Yes. >Next question: what should be for this Context the result of the query >Corresponding_Parent_Declaration, if the arguments represents the >(child) package P.Q? It cannot be P, because ASIS says, that a result >of Corresponding_Parent_Declaration may be one of the following kinds: > >-- Not_A_Unit >-- A_Package >-- A_Generic_Package >-- A_Package_Instance >-- A_Nonexistent_Declaration >-- An_Unknown_Unit > Correct, even though the Name P matches that of the parent, the unit P is not the semantically correct and consistent parent of P.Q. >It also cannot be a unit of A_Nonexistent_Declaration kind, because >units of this kind have (Ada) names, and the question is - what will >be the result of the Name query applied to such a Nonexistent unit? >It cannot be "P", because the Context already contains the unit of >A_Procedure_Body kind having "P" as its Ada name, and for any full >expanded Ada name an ASIS Context may contain at most one ASIS >Compilation Unit having this name. It also cannot be Not_A_Unit, because >a Nil_Compilation_Unit may be returned by this query only for Standard. The query is designed to return A_Nonexistent_Declaration in this case: -- Returns A_Nonexistent_Declaration when the Library_Unit has a -- parent_unit_name denoted in the defining_program_unit_name but the parent -- unit is not contained in the given Context. The name query can return "P". Since the unit is "nonexistent" it should not to considered to be within the Context, and hence there should be no conflict with the existing unit P. > >The last possibility is to raise an exception. Obsolete_Reference_Error >is fine for error kind to be set, but the question is - what exception >should be raised? Asis_Failed seems to be the only possible candidate, >but it is defined as: > > Asis_Failed : exception; > This is not how the query is designed, but I suppose this could always happen. Its not clear whether this would be considered a bug or a feature. >------------------------------------------------------------------------------ >-- All ASIS routines may raise Failed whenever they cannot normally complete >-- their operation. This exception will typically indicate a failure of the >-- underlying ASIS implementation. >-- >-- This is a catch-all exception that may be raised for different reasons >-- in different ASIS implementations. >------------------------------------------------------------------------------ > >It would be nice to have a special exception for the situations like >described above (similar example may be provided for subunits and >the Corresponding_Subunit_Parent_Body query), because Asis_Failed >looks "too general", and the situation does not look like "a failure >of the underlying ASIS implementation". > > >This example may be generalized like this: consider the following >sequences of the events taking place in the same environment: > >1. The package P is compiled. >2. Its child package P.Q is compiled >3. Its child P.Q.R is compiled. >4. Its child P.Q.R.S is compiled. >5. P.Q.R is recompiled as a child *procedure* of P.Q. > >And now two questions (supposing we are querying about the semantic >dependencies for P.Q.R.S by using the Semantic_Dependence_Order query): > >(1) What should be the result if we ask about *Ancestors* for P.Q.R.S? >(2) What should be result if we ask about *Supporters* for P.Q.R.S? > >What would make more sense for the first situation - to return the result >containing

, and as consistent unit list and > ... and what else .... as an inconsistent unit >list or to raise an exception (Asis_Failed?) with setting >Obsolete_Reference_Error error status? >For sure, for the second situation no exception should be raised, but should >the result contain all the supporters of the *procedure* P.Q.R, which >may have no relation to the obsolete package P.Q.S? (It seems that >it should...) Here is where I suggest the exception be raised for both situations, because now the attempt is being made to get valid semantic information based on inconsistent input. That, to me, is an error. >1. ASIS is ill-defined for the situations when ASIS should process > inconsistent unit sets (there are two kinds of these situations: > semantic dependencies between compilation units, and semantic queries > for elements, when the enclosing unit of the argument element is > inconsistent with the enclosing unit of the result argument. During > the technical discussion at the next to last ASISWG meeting in Florida > we agreed, that Asis_Failed should be raised for the second situation - > it would be nice to have this statement in the ASIS definition). > > The only statement related to processing inconsistent unit sets I > have found in ASIS 95 is (just preceding the Semantic_Dependence_Order > query in the Asis.Compilation_Units package): > >--|AN Application Note: >--|AN >--|AN To properly determine unit consistency, use one of the two semantic >--|AN dependence queries: Elaboration_Order or Semantic_Dependence_Order. >--|AN These queries return a value of the type Relationship, which contains >--|AN lists of consistent, inconsistent, missing and circular units. >--|AN >--|AN For these two queries, the existence of units in one or more of the >--|AN inconsistent, missing, or circular units list means that the consistent >--|AN unit list may not be complete. >--|AN >--|AN Applications that do not check for inconsistent, missing, or circular >--|AN units before using the consistent list might not operate as expected. >--|AN > > Have I missed something important? If I have not, I would say, that > it is too general and should be said in some more details. These are just minimal guidelines for using the results of this query. These comments do not attempt to address what happens when inconsistent units are provided as input to other queries. > > >2. I would suggest to add a new exception to the existing set of the ASIS > exceptions (Asis_Inconsistent_Unit_Set??) for the situation when ASIS > cannot provide any meaningful answer for a query because of some > inconsistency between units needed to be accessed when processing > the query. > I don't think this is necessary. Another exception just complicates things more. > > I would also explicitly indicate the situations when this exception > may (should?) be raised. I think, the example with the > Corresponding_Parent_Declaration query is on of such situations. > >Sergey. I'm always for clarifying things with additional commentary. However, I don't think Corresponding_Parent_Declaration is one such situation where this exception should be raised. > >P.S. Do you think it would make sense to move the discussion about this > problem to ASIS or ASIS-Technical forum? If it would make sense, > and if this message is OK to start the discussion, Clyde, > could you forward it to ASIS/ASIS-Technical. Now I came to > my office two-three times a week to check my mail... > By all means... Steve