Consider two procedure types in MYSTERY syntax
TYPE P1 = PROCEDURE (A1 a):R1, and
TYPE P2 = PROCEDURE (A2 a):R2
There are three possible requirements for P1 <: P2
- A1 = A2 and R1 = R2
- Arguments follow the argument part of the arrow rule and R1 = R2
- A1 = A2 and return types follows the return type part of the arrow rule
Answer the following questions:
- Discuss which of the above three possibilities you prefer. Provide
clear examples and arguments to support your preference.
- Assuming that MYSTERY allows
subtypes to be assigned to supertypes, uses structural equality, and uses the
obvious subtyping between subranges (e.g., [1 TO 10] <: [1 TO 100]) determine
which of the above three possibilities is used by
MYSTERY. Use
this link
to submit programs. You may submit up to six programs; you will
lose 5% of the points for each additional submission. Provide evidence
that supports your answer.