refactor: migrate examples to import Std::Io instead of raw extern func

- Create stdlib/Std/Io.bux with extern func declarations
- Rename C shim functions to short names (PrintLine, PrintInt, etc.)
- Update all 9 examples to use import Std::Io::{PrintLine, PrintInt};
- Remove manual extern func Std_Io_* declarations from examples
This commit is contained in:
2026-05-31 02:01:28 +03:00
parent c7114c0538
commit 92c5cd59f5
11 changed files with 84 additions and 74 deletions
+8 -8
View File
@@ -1,6 +1,6 @@
// Generics - Generic functions and structs
extern func Std_Io_PrintLine(s: String);
extern func Std_Io_PrintInt(n: int);
import Std::Io::{PrintLine, PrintInt};
func Max<T>(a: T, b: T) -> T {
if a > b {
@@ -14,13 +14,13 @@ func Main() -> int {
let m1: int = Max<int>(10, 20);
let m2: int = Max<int>(5, 3);
Std_Io_PrintLine("Max(10, 20) = ");
Std_Io_PrintInt(m1);
Std_Io_PrintLine("");
PrintLine("Max(10, 20) = ");
PrintInt(m1);
PrintLine("");
Std_Io_PrintLine("Max(5, 3) = ");
Std_Io_PrintInt(m2);
Std_Io_PrintLine("");
PrintLine("Max(5, 3) = ");
PrintInt(m2);
PrintLine("");
return 0;
}