generic function with structural types questions

# Yuh-Ruey Chen (18 years ago)

Given the following definitions:

class C {var p: int}; type S1 = {p: int}; type S2 = {p: int, p2: double}; generic function foo(x); generic function foo(x: *) 0 generic function foo(x: C) 1 generic function foo(x: S1) 2 generic function foo(x: S2) 3 generic function foo(x: like S1) 4 generic function foo(x: like S2) 5 var o1: C = new C(); var o2: S1 = {p: 10}; var o3: S2 = {p: 10, p2: 3.14}; var o4 = {p: 10}; var o5 = {p: 10, p2: 3.14}; var o6 = {p: 10, p2: 3.14, p3: "hi"};

What do the following exprs evaluate to? foo(o1); foo(o2); foo(o3); foo(o4); foo(o5); foo(o6);

Also, I know that S1 <: Object, but is S2 <: S1? I've looked at clarification:type_system and it's not clear to me. Is it still true that C <: S1?

-Yuh-Ruey Chen

# Yuh-Ruey Chen (18 years ago)

By "fixed", do you mean an RI bug or a spec issue? If it's just an RI bug, can you tell me what those exprs are supposed to evaluate to?

-Yuh-Ruey Chen

# Lars Hansen (18 years ago)

It's a spec issue.