comp.lang.ada
 help / color / mirror / Atom feed
From: norvell@utcsri.UUCP (Theodore S)
Subject: Re: Procedure Parameters in Ada
Date: Fri, 13-Jun-86 16:58:17 EDT	[thread overview]
Date: Fri Jun 13 16:58:17 1986
Message-ID: <2968@utcsri.UUCP> (raw)
In-Reply-To: 782@petsd.UUCP

> []
 In article <8606042209.AA23350@vrdxhq.uucp> drm1@vrdxhq.UUCP (Donn Milton) writes:
>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.  
 
Chris Henrich writes that ISO [International Standards Org.]
Pascal has procedural & functional parameters and suggests.
> (a) what ANSI/ISO mandates is not "strong" in Donn Milton's sense;
> (b) something in Pascal corresponds to "recursive mode-type declarations;
> (c) for some other reason, the theorem being cited is beside the point.

I think the problem is that ISO Pascal puts some restrictions on which
procedures can be passed as arguments to which.  For example given
a procedure P, can P be passed as a procedure to itself i.e. P(P)?
In ISO Pascal the answer is no, in algol 68 it is yes.  This restriction 
is enforced mainly in the syntax. Which in ISO Pascal is:
	procheader ::= "procedure" name [ "(" formal {; formal} ")" ]
	formal     ::= ["var"] name ":" formal_type
		     | procheader | functionheader
Thus to write P's header we would have to say:
procedure P ( procedure Q (procedure R ( procedure S ... ad infinitum
which you can't since programmes must be of _finite_ length.

Perhaps the language for which Mr. Sherman wrote his complier is
the same way.  (I know that the Turing language developed at 
U. of Toronto is.)

In algol 68 you can just say (pardon my syntax):
type T = proc( T );   (* recursive type declaration *)
proc P( Q : T ) = <body of P>

Langmaak's paper (acta info. Vol 2) describes 4 languages, none of which
correspond to Pascal's way of doing things and one of which corresponds
to algol 68's. He proves that of the 4 only in the algol 68 like one can
full type checking be done at compile time.  Obviously this is also
true of the ISO Pascal way of declaring procedural parameters.
Thus the answer is (c), the theorem is just not relevant to Pascal.
But it is interesting, so thanks to Donn Milton for pointing it out.

					Theo Norvell
					norvell@utcsri

  parent reply	other threads:[~1986-06-13 20:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1986-06-04 22:09 Procedure Parameters in Ada 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 message]
  -- strict thread matches above, loose matches on Subject: below --
1986-06-09 16:39 Donn Milton
1986-06-11 16:01 Donn Milton
replies disabled

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