comp.lang.ada
 help / color / mirror / Atom feed
From: rh@MITRE-BEDFORD.ARPA (Rich Hilliard - Mitre Software Center)
Subject: Re: Restrictions on Ada Main Programs
Date: Fri, 12-Dec-86 11:35:13 EST	[thread overview]
Date: Fri Dec 12 11:35:13 1986
Message-ID: <8612121635.AA28148@mitre-bedford.ARPA> (raw)


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 <rh>
> 
> 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

             reply	other threads:[~1986-12-12 16:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1986-12-12 16:35 Rich Hilliard - Mitre Software Center [this message]
  -- strict thread matches above, loose matches on Subject: below --
1986-12-01 16:01 Restrictions on Ada Main Programs Rich Hilliard - Mitre Software Center
1986-12-06  6:03 ` Geoff Mendal
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox