53b43b0f79
Ship the QUALITY_PLAN stretch from ownership through ecosystem: C.1 lifetime elision (bootstrap + selfhost), bux fmt/test/doc CI hooks, stdlib goldens, package registry (bux search/add), and LSP 0.4 position-sensitive locals with inferred let types. Full-tree format pass plus Map/Set remove double-free fix.
27 lines
437 B
Plaintext
27 lines
437 B
Plaintext
// Generics - Generic functions and structs
|
|
import Std::Io::{PrintLine, PrintInt};
|
|
|
|
|
|
func Max<T>(a: T, b: T) -> T {
|
|
if a > b {
|
|
return a;
|
|
} else {
|
|
return b;
|
|
}
|
|
}
|
|
|
|
func Main() -> int {
|
|
let m1: int = Max<int>(10, 20);
|
|
let m2: int = Max<int>(5, 3);
|
|
|
|
PrintLine("Max(10, 20) = ");
|
|
PrintInt(m1);
|
|
PrintLine("");
|
|
|
|
PrintLine("Max(5, 3) = ");
|
|
PrintInt(m2);
|
|
PrintLine("");
|
|
|
|
return 0;
|
|
}
|