PROCANY is a subtype of ADDRESS, and is a
supertype of all PROCEDURE types.
PROCANY is a subtype of ADDRESS, and a
supertype of all PROCEDURE types. In order to prevent
nested procedures from escaping, we add one runtime check. When a
procedure formal is passed as an argument, where the corresponding
formal is PROCANY or ADDRESS, we must check
that the procedure is not nested.
PROCEDURE p() =
BEGIN
END p;
PROCEDURE q(x:PROCANY) =
BEGIN
END q;
PROCEDURE r(x:PROCEDURE ()) =
BEGIN
q(x); (* legal, incurs runtime check to ensure
that x is not a nested procedure *)
END r;
q(p) (* legal, no runtime check *)