comp.lang.ada
 help / color / mirror / Atom feed
* Re: Procedure Parameters in Ada
@ 1986-06-11 16:01 Donn Milton
  0 siblings, 0 replies; 8+ messages in thread
From: Donn Milton @ 1986-06-11 16:01 UTC (permalink / raw)


With reference to Chris Henrich's comments on type-checking in Pascal,
the Pascals I've seen only require that the type of the return
value be specified, such as:
		procedure dummy (function f: real);
There is no way to specify what the parameters to the formal function
'f' must be.  Thus although some type checking is possible, it is
IN GENERAL not possible to check that calls of f will always use the
correct parameters.  Recursive calls to a type-checking routine
won't hack it.

Please note:  the validity of the last sentence in the above paragraph
is by no means immediately obvious (at least to me).  One might
imagine the possibility of a type-checker that took into account
all possible execution paths of a program in order to check that all
procedures are always called with the correct number and type of
parameters.  But Langmaack, with a rather ingenious argument, shows
that such a type-checker cannot in fact be built (in the absence of
fully-specified procedure parameter types).

Donn Milton

^ permalink raw reply	[flat|nested] 8+ messages in thread
* Re: Procedure Parameters in Ada
@ 1986-06-09 16:39 Donn Milton
  0 siblings, 0 replies; 8+ messages in thread
From: Donn Milton @ 1986-06-09 16:39 UTC (permalink / raw)



	
	>Ie. for the recursion above, couldn't something like
	>
	>	type procIrec = procedure ( integer i; procIrec p ) ;
	>
	>be permissible, and also stop the expansion of the type indefinitely?
	>And, more importantly, be distinct from
	>
	>	type otherprocIrec = procedure ( integer i; procIrec p ) ;
	>
	>which is structurally, but not name, equivalent.
	>
	>?
	>
	>
	>Andy "Krazy" Glew. Gould CSD-Urbana.
	
I have discussed constructs like this with some people, and can't find
any real holes in the idea.  I would certainly like to see this concept
considered for Ada '88.  Unfortunately, at that point, the impact that
such an addition would have on mature Ada compilers will have to be
a major consideration.

Donn Milton

^ permalink raw reply	[flat|nested] 8+ messages in thread
* Procedure Parameters in Ada
@ 1986-06-04 22:09 Donn Milton
  1986-06-08 19:11 ` aglew
  1986-06-09 17:55 ` Chris Henrich
  0 siblings, 2 replies; 8+ messages in thread
From: Donn Milton @ 1986-06-04 22:09 UTC (permalink / raw)



Many people seem to be unaware of a major problem entailed by
procedures as parameters.  That is, when procedures are allowed
as parameters, strong type-checking becomes generally undecidable
(not just hard) UNLESS recursive mode-type declarations (a la Algol 68)
are introduced.  For example, in languages like Fortran, Algol 60,
PL/1, and C, strong type-checking cannot be done.  This was proved
formally by Langmaack in "On Correct Procedure Parameter
Transmission in Higher Programming Languages," Acta Informatica,
Vol. 2, 1973, pp. 110-142.

With the declaration mechanism available in Algol 68, it is possible
to declare "a procedure that has two parameters: an integer and a
procedure that has two parameters: an integer and a procedure that
has two parameters ..." ad infinitum, which is required for strong
type-checking of procedure parameters.  Understand that
type equivalence in Algol 68 means structural equivalence,
while type equivalence in Ada means name equivalence -- thus
type-checking is much simpler in Ada.

However, I do not understand why such a declaration mechanism, which
would allow procedures as parameters with strong type-checking,
was not included in Ada.  Algol 68 had demonstrated its
feasibility (with some elegance), and, as far as I know,
this capability is not a source of significant compile-time
or run-time inefficiencies.

Donn Milton

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~1986-06-13 20:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1986-06-11 16:01 Procedure Parameters in Ada Donn Milton
  -- strict thread matches above, loose matches on Subject: below --
1986-06-09 16:39 Donn Milton
1986-06-04 22:09 Donn Milton
1986-06-08 19:11 ` aglew
1986-06-09 17:55 ` Chris Henrich
1986-06-10 20:22   ` Jerry Sweet
1986-06-13 20:31     ` wf
1986-06-13 20:58   ` Theodore S

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