From leguenne@act-europe.fr Fri Oct 17 09:28:33 1997 Return-Path: Received: from ida.org by cronus.csed.ida.org (SMI-8.6/SMI-SVR4) id JAA29912; Fri, 17 Oct 1997 09:28:33 -0400 Received: from mail.acm.org by ida.org (4.1/SMI-4.1) id AA18553; Fri, 17 Oct 97 09:29:42 EDT Received: from sw-eng.falls-church.va.us (ns1.sw-eng.falls-church.va.us [199.75.54.2]) by mail.acm.org (8.8.5/8.7.5) with ESMTP id JAA06438; Fri, 17 Oct 1997 09:33:35 -0400 Received: from paris.act-europe.fr by sw-eng.falls-church.va.us (8.7.1/) id NAA27554; Fri, 17 Oct 1997 13:21:54 GMT Received: (from leguenne@localhost) by paris.act-europe.fr (8.8.5/8.8.5) id PAA13183; Fri, 17 Oct 1997 15:19:28 +0200 Date: Fri, 17 Oct 1997 15:19:28 +0200 Message-Id: <199710171319.PAA13183@paris.act-europe.fr> From: Alain Leguennec To: asis-comment@sw-eng.falls-church.va.us, rybin@possum.srcc.msu.su Cc: asis-officers@sw-eng.falls-church.va.us Subject: Formal package parameters seen as instantiations from inside the generic template. Content-Length: 1591 Status: OR Please consider the following example: generic package GP1 is procedure Proc; end GP1; -- GP1's body omitted. generic with package P1 is new GP1 (<>); with package P2 is new GP1 (<>); procedure GP2; procedure GP2 is begin P1.Proc; P2.Proc; end; Now suppose I analyze the procedure GP2 as a template (not an instantiation of it.) The question I have is about the result of Corresponding_Called_Entity on "P1.Proc" (or "P2.Proc"), which I think needs some clarification. My opinion is that it should return a subprogram declaration that is Is_Part_Of_Instance and whose Enclosing_Element is A_Generic_Package_Declaration that is itself part of instance (cf RM 12.7 (4)) and whose Enclosing_Element eventually is the formal package declaration (which is also a kind of instantiation) P1 (resp. P2). Is that right ? If so, I think that Corresponding_Declaration & Corresponding_Body missed A_Formal_Package_Declaration as an appropriate parameter kind, and they should (respectively) return the expanded template spec and expanded template body as described above (like they do for other kind of instantiations.) Note that the problem arises only when analyzing GP2 as a template. When analyzing an instantiation of GP2, Corresponding_Called_Entity gives subprograms declared inside the actual package for P1 (resp P2) (which are themselves instance of GP1.) BTW, Corresponding_Declaration also missed generic_renamings as possible parameters (it has other renaming declarations, and generic declarations, but generic_renamings are new in Ada95.) -- Alain Le Guennec. From roby Tue Dec 9 15:59:29 1997 Return-Path: Received: by cronus.csed.ida.org (SMI-8.6/SMI-SVR4) id PAA06578; Tue, 9 Dec 1997 15:59:21 -0500 From: roby (Clyde Roby) Message-Id: <199712092059.PAA06578@cronus.csed.ida.org> Subject: Formal package parameters seen as instantiations from inside the generic template. To: Alain.LeGuennec@enst-bretagne.fr (Alain LeGuennec) Date: Tue, 9 Dec 1997 15:59:21 -0500 (EST) Cc: roby (me), Colket@ACM.Org (Currie Colket), rybin@alex.srcc.msu.su (Rybin) X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Length: 3645 Status: OR Alain, Concerning your email message (see below), which is now ASIS Issue #084, we have some questions. If we were to make the following changes, would your issue be resolved? 1. To clause 15.26 Asis.Declaration.Corresponding_Declaration, Add to "Appropriate Declaration_Kinds returning a specification": A_Formal_Package_Declaration A_Generic_Package_Renaming_Declaration (renaming-as-body) A_Generic_Procedure_Renaming_Declaration (renaming-as-body) A_Generic_Function_Renaming_Declaration (renaming-as-body) Add to "Appropriate Declaration_Kinds returning the argument declaration": A_Formal_Package_Declaration A_Generic_Package_Renaming_Declaration (renaming-as-declaration) A_Generic_Procedure_Renaming_Declaration (renaming-as-declaration) A_Generic_Function_Renaming_Declaration (renaming-as-declaration) 2. To clause 15.27 Asis.Declaration.Corresponding_Body, Add to "Appropriate Declaration_Kinds returning a body": A_Formal_Package_Declaration Add to "Appropriate Declaration_Kinds returning the argument declaration": A_Formal_Package_Declaration Have we missed anything? Should any of the A_Generic_xxx_Renaming_Declaration Declaration_Kinds listed in 15.26 be included in 15.26 (as we listed above)? Should any be included in 15.27? If you concur with the above changes (listed in 1. and 2.), we will circulate the issue amongst ASIS-Technical for discussion/concurrence. Clyde and Currie Your original email message: > From leguenne@act-europe.fr Fri Oct 17 09:28:33 1997 > Date: Fri, 17 Oct 1997 15:19:28 +0200 > Message-Id: <199710171319.PAA13183@paris.act-europe.fr> > From: Alain Leguennec > To: asis-comment@sw-eng.falls-church.va.us, rybin@possum.srcc.msu.su > Cc: asis-officers@sw-eng.falls-church.va.us > Subject: Formal package parameters seen as instantiations from inside the generic template. > Content-Length: 1591 > > > Please consider the following example: > > generic > package GP1 is > procedure Proc; > end GP1; > -- GP1's body omitted. > > generic > with package P1 is new GP1 (<>); > with package P2 is new GP1 (<>); > procedure GP2; > > procedure GP2 is > begin > P1.Proc; > P2.Proc; > end; > > Now suppose I analyze the procedure GP2 as a template (not an instantiation of it.) > The question I have is about the result of Corresponding_Called_Entity on "P1.Proc" > (or "P2.Proc"), which I think needs some clarification. > My opinion is that it should return a subprogram declaration that is Is_Part_Of_Instance > and whose Enclosing_Element is A_Generic_Package_Declaration that is itself > part of instance (cf RM 12.7 (4)) and whose Enclosing_Element eventually is > the formal package declaration (which is also a kind of instantiation) P1 (resp. P2). > Is that right ? > > If so, I think that Corresponding_Declaration & Corresponding_Body > missed A_Formal_Package_Declaration as an appropriate parameter kind, > and they should (respectively) return the expanded template spec > and expanded template body as described above (like they do for > other kind of instantiations.) > > Note that the problem arises only when analyzing GP2 as a template. > When analyzing an instantiation of GP2, Corresponding_Called_Entity > gives subprograms declared inside the actual package for P1 (resp P2) > (which are themselves instance of GP1.) > > BTW, Corresponding_Declaration also missed generic_renamings as possible parameters > (it has other renaming declarations, and generic declarations, but generic_renamings > are new in Ada95.) > > -- > Alain Le Guennec. From leguenne@act-europe.fr Wed Dec 17 08:09:10 1997 Return-Path: Received: from cs.ida.org by cronus.csed.ida.org (SMI-8.6/SMI-SVR4) id IAA10753; Wed, 17 Dec 1997 08:09:10 -0500 Received: from paris.act-europe.fr (leguenne@paris.act-europe.fr [195.25.32.140]) by cs.ida.org (8.8.7/8.8.7) with ESMTP id IAA21415 for ; Wed, 17 Dec 1997 08:10:18 -0500 (EST) Received: (from leguenne@localhost) by paris.act-europe.fr (8.8.5/8.8.5) id OAA31577; Wed, 17 Dec 1997 14:16:04 +0100 Date: Wed, 17 Dec 1997 14:16:04 +0100 Message-Id: <199712171316.OAA31577@paris.act-europe.fr> From: Alain Leguennec To: roby@ida.org In-reply-to: <199712092126.QAA06646@cronus.csed.ida.org> (roby@ida.org) Subject: Re: Formal package parameters seen as instantiations from inside the generic template. References: <199712092126.QAA06646@cronus.csed.ida.org> Content-Length: 3444 Status: OR Hello, << Concerning your email message (see below), which is now ASIS Issue #084, we have some questions. If we were to make the following changes, would your issue be resolved? >> I think it would be better to split this issue into two separate issues. -The first issue, dealing with A_Formal_Package_Declaration[_With_Box] being also considered as instantiations. This implies some modifications to Corresponding_Declaration/Body, at least. Note that for the application I am developping, I do not need to get the expanded spec/body of formal packages. But I need the "reverse", ie if I have occurences in the generic template of references to entities declared in some of the "expanded" formal package parameters, I need to determine which is the corresponding formal package. For that purpose, I would like to use Enclosing_Element till I reach the formal package declaration, like I would do to go from an element that is part of instance back to the corresponding instantiation. That's why I want to be sure formal packages are treated like any other instantiations. BTW ,I forgot to mention the "With_Box" possibility in my original mail. -The second issue, consisting in adding generic_renaming_declarations as appropriate parameters to the Corresponding_Declaration/Body queries. This second issue seems much less important to me. Those 2 issues are IMHO totally independant. Now some comments about your proposal: << 1. To clause 15.26 Asis.Declaration.Corresponding_Declaration, Add to "Appropriate Declaration_Kinds returning a specification": A_Formal_Package_Declaration -- With_Box alternative missing A_Generic_Package_Renaming_Declaration (renaming-as-body) A_Generic_Procedure_Renaming_Declaration (renaming-as-body) A_Generic_Function_Renaming_Declaration (renaming-as-body) Add to "Appropriate Declaration_Kinds returning the argument declaration": A_Formal_Package_Declaration -- With_Box alternative missing A_Generic_Package_Renaming_Declaration (renaming-as-declaration) A_Generic_Procedure_Renaming_Declaration (renaming-as-declaration) A_Generic_Function_Renaming_Declaration (renaming-as-declaration) >> I don't think it makes any sense at all to talk about "as-declaration" vs "as-body" in the case of generic_renaming_declaration. Hence they should be removed from the first of the 2 lists. << 2. To clause 15.27 Asis.Declaration.Corresponding_Body, Add to "Appropriate Declaration_Kinds returning a body": A_Formal_Package_Declaration >> Looks OK, except A_Formal_Package_Declaration_With_Box is missing. << Add to "Appropriate Declaration_Kinds returning the argument declaration": A_Formal_Package_Declaration >> Sorry, I don't understand this one. Isn't it in contradiction with the previous addition ? How can Corresponding_Body return the argument declaration unchanged if it is to return the expanded body of the formal package "instantiation" ? << Have we missed anything? Should any of the A_Generic_xxx_Renaming_Declaration Declaration_Kinds listed in 15.26 be included in 15.26 (as we listed above)? Should any be included in 15.27? If you concur with the above changes (listed in 1. and 2.), we will circulate the issue amongst ASIS-Technical for discussion/concurrence. Clyde and Currie >> I really think separating this into 2 issues would simplify the discussion. Best regards, /Alain.