ags@pucc-i (Seaman) (05/17/84)
> 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."
adrian@ru-cs44.UUCP (05/19/84)
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 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
UKadrian@ru-cs44.UUCP (05/28/84)
Well, actually M2UNIX is a 5-pass compiler, but not all those are
concerned with the circular errors. Error occurs on pass 2
--
Adrian Pell ({vax135,mcvax,edcaad}!ukc!ru-cs44!adrian)
Computer Science Dept.
University of Reading
UK