Algol 60 Procedure Types
In Algol 60, the type of each formal parameter of a procedure must be given. How- ever, proc is considered a type (the type of procedures). This is much simpler than the ML types of function arguments. However, this is really a type loophole; because calls to procedure parameters are not fully type checked, Algol 60 programs may produce run-time type errors.
Write a procedure declaration for Q that causes the following program fragment to produce arun-time type error:
proc P (proc Q)
begin Q(true) end; P(Q);
where true is a Boolean value. Explain why the procedure is statically type correct, but produces a run-time type error. (You may assume that adding a Boolean to an integer is arun-time type error.)