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, MSGID_SHORT autolearn=no autolearn_force=no version=3.4.4 Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site utcsri.UUCP Path: utzoo!utcsri!norvell From: norvell@utcsri.UUCP (Theodore S) Newsgroups: net.lang.ada Subject: Re: Procedure Parameters in Ada Message-ID: <2968@utcsri.UUCP> Date: Fri, 13-Jun-86 16:58:17 EDT Article-I.D.: utcsri.2968 Posted: Fri Jun 13 16:58:17 1986 Date-Received: Fri, 13-Jun-86 17:25:54 EDT References: <8606042209.AA23350@vrdxhq.uucp> <782@petsd.UUCP> Organization: CSRI, University of Toronto List-Id: > [] 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 ) = 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