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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!lll-crg!ames!ucbcad!ucbvax!MITRE-BEDFORD.ARPA!rh From: rh@MITRE-BEDFORD.ARPA (Rich Hilliard - Mitre Software Center) Newsgroups: comp.lang.ada Subject: Re: Restrictions on Ada Main Programs Message-ID: <8612121635.AA28148@mitre-bedford.ARPA> Date: Fri, 12-Dec-86 11:35:13 EST Article-I.D.: mitre-be.8612121635.AA28148 Posted: Fri Dec 12 11:35:13 1986 Date-Received: Mon, 15-Dec-86 19:35:23 EST Sender: daemon@ucbvax.BERKELEY.EDU Organization: The MITRE Corp., Bedford, MA List-Id: Last week, I posted a question on Ada main programs (see end of this message). Geoff Mendal has pointed out to me that I goofed, he writes: The implementation is correct to reject your generic instantiation as a main program. A careful reading of LRM 10.1(8) shows that only a SUBPROGRAM that is a library unit can be a main program. While 10.1(2) allows generic instantations to be library units, a subprogram is not the same as a generic instantiation. Using the syntagmas in 10.1(2) and the prose in 10.1(8) we find that only a "proper" subprogram (not an instantiation) can be a main program. Now, more questions: There ARE compilers which accept generic instantiations as main programs - that's what got me wondering about this in the first place. Are such implementations non-conforming? What is the rationale for distinguishing generic instantiations from "first-class" library units? > Subject: Restrictions on Ada Main Programs > Date: Mon, 01 Dec 86 11:01:53 EST > From: Rich Hilliard - Mitre Software Center > > I always thought I understood Ada RM 10.1 (8): > > ... An implementation may impose certain requirements on the > parameters and on the result, if any, of a main program (these > requirements must be stated in Appendix F). In any case, > every implementation is required to allow, at least, main > programs that are parameterless procedures, and every main > program must be a subprogram that is a library unit. > > > In particular, I thought "parameters" referred to run-time parameters > - those supplied in a call. Now I find an implementation that rejects > generic instantiations of otherwise "parameterless" procedures owing > to the presence of a generic formal parameter (see below) and citing > this paragraph. Is this a legitimate interpretation or merely an > implementor error? > > > generic > Default : Integer := 10; > procedure Generic_Install; > > > procedure Generic_Install is > Site_Selectable_Parameter : Integer; > begin > Site_Selectable_Parameter := Default; > end Generic_Install; > > > with Generic_Install; > procedure Install is new Generic_Install; > -- ^^^^^^^ > -- RM 10.1(8): instantiation install can not be a main program > -- A parameterless integer function or procedure is required