Phase 5-7: generic inference, extend Type<T>, String stdlib, Map<K,V>, self-hosting audit, docs update

This commit is contained in:
2026-05-31 13:06:29 +03:00
parent 25f846bb00
commit 5c1a00cbd6
17 changed files with 1329 additions and 134 deletions
+26
View File
@@ -0,0 +1,26 @@
// Generic function type inference — calls without explicit type args
import Std::Io::{PrintLine, PrintInt};
func Max<T>(a: T, b: T) -> T {
if a > b {
return a;
} else {
return b;
}
}
func Main() -> int {
// Inferred: T = int
let m1: int = Max(10, 20);
let m2: int = Max(5, 3);
PrintLine("Max(10, 20) = ");
PrintInt(m1);
PrintLine("");
PrintLine("Max(5, 3) = ");
PrintInt(m2);
PrintLine("");
return 0;
}