classage X { // if not commented out, the following line does not typecheck // because the export method and the import method does not conform // to the subtyping constraints. // (They have different types of contravariants). /* mixer A { import void f(int x) export void f() {} } */ // if not commented out, the following line does not typecheck // because the export method and the import method does not conform // to the subtyping constraints. // (They have different types of convariants). /* mixer B { import void f() export int f() { return 1;} } */ // if not commented out, the following line does not typecheck // because the export method and the import method does not conform // to the subtyping constraints. // (The contravariants do not conform to subtyping). /* mixer C { import void f(Sub2 x) export void f(Sub1 x) { } } */ // if not commented out, the following line does not typecheck // because the export method and the import method does not conform // to the subtyping constraints. // (The convariants do not conform to subtyping). /* mixer D { import Sub1 f() export Sub2 f() { return create Sub2(); } } */ // however, when subtyping is complied, the program does go through. mixer C { import void f(Sub1 x) export void f(Sub2 x) { } } mixer D { import Sub2 f() export Sub1 f() { return create Sub1(); } } // the situation is similar for pluggers. /* plugger A { import void f(int x) export void f() {} } */ /* plugger B { import void f() export int f() { return 1;} } */ /* plugger C { import void f(Sub2 x) export void f(Sub1 x) { } } */ /* plugger D { import Sub1 f() export Sub2 f() { return create Sub2(); } } */ // We however disallow overriding on connectors. // if not commented out, the following line will complain. /* connector A { import void f() export void f() {} } */ } classage Sub1 { connector E { export void a() { return; } } } classage Sub2 { connector E { export void a() { return; } import void c() } }