/***************************************************************** Followed is typechecking of the create expression None of the expressions, unless noted otherwise, typecheck ******************************************************************/ classage X { void t() { //M does not exist //create M(); //If a classage does not define constructors expicitly, //the only valid constructor is the default one. create Z(3); //If a classage does explicitly define constructor(s), // the default constructor is not added. create W(); //can not find an appropriate constructor; does not exist at all create U(3); //can not find an appropriate constructor; subtyping violation create U(create Sub2()); // type mismatch on assignment, a test on return type int x = create U(); // however the following works U z = create U(); } } /***************************************************************** Followed is typechecking of atomic classage constructors None of the expressions, unless noted otherwise, typecheck ******************************************************************/ classage Atomic1 { // a constructor must have the same name as the classage name // Atomic2() {} } classage Atomic2 { // disallow this syntax. Only allow "this" call in atomic classages Atomic2() { :Atomic3(); } } classage Atomic3 { // can not find appropriate constructor, does not exist at all Atomic3() { this(true); } } classage Atomic4 { // can not find appropriate constructor, subtyping violation Atomic4() { this(create Sub2()); } Atomic4(Sub1 x) { } } /***************************************************************** Some definition used by above ******************************************************************/ classage U { mixer E { export void a(int x) {} } U() { } U(Sub1 x) {} } classage W { W(int x) {} } classage Z { } classage Sub1 { connector E { export void a() { return; } } } classage Sub2 { connector E { export void a() { return; } import void c() } }