Initial Commit

This commit is contained in:
SoraKatadzuma committed 2026-10-28 22:13:49 -05:00
commit 05756094ac
706 files changed
+135430

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
import std::io;
trait into<T> { def into(&this): T; }
trait pair<T>: into<T> {
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<i64> { 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<i64> = &o;
val c := card{ n = 2 };
val b: &both = &c;
println($"{p.twice()} {tell(b)} {b.first()}");
}