# Abstract interface: interface InterA { routine size()=>int routine serialize()=>string } # Concrete interface for int: interface InterA for int { routine size(){ io.writeln( "InterA::size()", std.about(self) ) io.writeln( "InterA::size()", self.serialize() ); return (int)self + 1; } routine serialize() => string { return "abc" + (string) self; } } @[test()] var a: InterA = 123 # a: value type InterA; variable type InterA; io.writeln( std.about(a) ) class K { routine size(){ return 1 } routine serialize() => string { return "abc"; } } a = K() @[test()] @[test()] {{InterA}} @[test()] @[test()] var b = (InterA) 123; io.writeln( std.about(b) ) @[test()] @[test()] {{InterA}} @[test()] @[test()] var c: InterA = 123 io.writeln( std.about(c) ) @[test()] @[test()] {{InterA}} @[test()] @[test()] var c: InterA = 123 var d: int = c @[test()] @[test()] @[test()] @[test()] var e: list> = { 123 } e.append(456) io.writeln( e ) @[test()] @[test()] {{abc123, abc456}} @[test()] @[test()] var f: list = { 678 } f.append(456) io.writeln( f ); @[test()] @[test()] {{abc678, abc456}} @[test()] interface InterB : InterA { routine []( index: int ) => int } interface InterB for int : InterA { routine []( index: int ) => int { return ((int)self & (1<> index; } } @[test()] var k = (InterB) 0x7ffeff; var f: list = { 678 } f.append( k ) io.writeln( f, k[1] ) @[test()] @[test()] { abc678, abc8388351 } 1 @[test()] @[test()] var k = (InterB) 0x7ffeff; var h = (InterA) k; io.writeln( std.about(h) ) @[test()] @[test()] {{InterB}} @[test()] @[test()] var k = (InterB) 0x7ffeff; var m: InterA = k; io.writeln( std.about(m) ) @[test()] @[test()] {{InterB}} @[test()] @[test()] var k = (InterB) 0x7ffeff; var s = (InterA) k; io.writeln( std.about(s) ) @[test()] @[test()] {{InterB}} @[test()] @[test()] interface InterC : InterB { } @[test()] @[test()] {{Invalid parent interface}} @[test()] @[test()] interface InterC for int : InterB { } @[test()] @[test()] {{Need symbol of interface}} @[test()] @[test()] interface InterC {} interface InterC for int : InterB { } @[test()] @[test()] {{Invalid parent interface}} @[test()] @[test()] interface InterC : InterA { } interface InterC for int : InterB { } @[test()] @[test()] {{Invalid parent interface}} @[test()] @[test()] interface InterC : InterA { routine method(); } interface InterC for int : InterA { } @[test()] @[test()] {{Incomplete concrete interface implementation}} @[test()]