Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site pucc-i Path: utzoo!watmath!clyde!burl!mgnetp!ihnp4!inuxc!pur-ee!CS-Mordred!Pucc-H:Pucc-I:ags From: ags@pucc-i (Seaman) Newsgroups: net.lang.mod2 Subject: Re: circular procedure types Message-ID: <277@pucc-i> Date: Thu, 17-May-84 12:49:22 EDT Article-I.D.: pucc-i.277 Posted: Thu May 17 12:49:22 1984 Date-Received: Sat, 19-May-84 00:40:06 EDT References: <840@unm-cvax.UUCP> <670@ru-cs44.UUCP> Organization: Purdue University Computing Center Lines: 44 > Our compiler (M2UNIX for the PDP-11) doesn't allow this program, > complaining as follows: > > 1 MODULE circproc; > 2 > 3 TYPE Circular = PROCEDURE(Circular, CARDINAL): CARDINAL; > **** ^74: type not declared > 4 > 5 PROCEDURE a(b: Circular; x: CARDINAL): CARDINAL; > 6 BEGIN > 7 IF x = 0 THEN > 8 RETURN 1 > 9 ELSE > 10 RETURN x * b(b, x - 1) > 11 END > 12 END a; > 13 > 14 PROCEDURE Factorial(n: CARDINAL): CARDINAL; > 15 BEGIN > 16 RETURN a(a, n) > **** ^128: type incompatibility > 17 END Factorial; > 18 > 19 END circproc. I am not familiar with M2UNIX, but I'll bet it's a one-pass compiler. Volition Systems (also one-pass) gives the same error on line 3 but does not complain about line 16. > > I guess you could do it with two procedures and two definition modules > but ... > > -- > Adrian Pell ({vax135,mcvax,edcaad}!ukc!ru-cs44!adrian) > Computer Science Dept. > University of Reading > UK -- Dave Seaman ..!pur-ee!pucc-i:ags "Against people who give vent to their loquacity by extraneous bombastic circumlocution."