import std::io; trait into { def into(&this): T; } trait pair: into { def twice(&this): T { return this.into(); } } trait shown { def show(&this): string; } trait both { def first(&this): i64; def show(&this): string; } struct one: pair { var v: i64; } def one::into(&this): i64 { return this.v; } struct card { var n: i64; } def card::show(&this): string { return "card"; } def card::first(&this): i64 { return this.n; } def tell(x: &shown): string { return x.show(); } def main(): void { val o := one{ v = 5 }; val p: &pair = &o; val c := card{ n = 2 }; val b: &both = &c; println($"{p.twice()} {tell(b)} {b.first()}"); }