Consider the following functions:
let printPerson(p :Person) :Person = begin ... p end;
let printStudent(s :Student) :Student = begin ... s end;
Now consider a person and a student:
let p :Person = tuple ... end;
let s :Student = tuple ... end;
and the following four functions:
let a(p :Person print(:Person) :Person) :Person = print(p);
let b(p :Person print(:Person) :Student) :Student = print(p);
let c(s :Student print(:Student) :Person) :Person = print(s);
let d(s :Student print(:Student) :Student) :Student = print(s);
Can you tell which of the possible 16 combinations between these
functions having 'p' or 's' as first parameter and 'printPerson' or 'printStudent' as second parameter are valid with respect to Tycoon
subtyping rules and what are the reasons of errors (in case of multiple errors, consider the first)?
STATUS REASON
a(p printPerson)
a(p printStudent)
a(s printPerson)
a(s printStudent)
b(p printPerson)
b(p printStudent)
b(s printPerson)
b(s printStudent)
c(p printPerson)
c(p printStudent)
c(s printPerson)
c(s printStudent)
d(p printPerson)
d(p printStudent)
d(s printPerson)
d(s printStudent)