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:
@@ -1,6 +1,6 @@
|
||||
// Structs - Basic struct usage
|
||||
extern func Std_Io_PrintLine(s: String);
|
||||
extern func Std_Io_PrintInt(n: int);
|
||||
import Std::Io::{PrintLine, PrintInt};
|
||||
|
||||
|
||||
struct Point {
|
||||
x: int;
|
||||
@@ -17,13 +17,13 @@ func Main() -> int {
|
||||
let p2: Point = Point { x: 5, y: 15 };
|
||||
let sum: Point = AddPoints(p1, p2);
|
||||
|
||||
Std_Io_PrintLine("Point sum:");
|
||||
Std_Io_PrintLine("x = ");
|
||||
Std_Io_PrintInt(sum.x);
|
||||
Std_Io_PrintLine("");
|
||||
Std_Io_PrintLine("y = ");
|
||||
Std_Io_PrintInt(sum.y);
|
||||
Std_Io_PrintLine("");
|
||||
PrintLine("Point sum:");
|
||||
PrintLine("x = ");
|
||||
PrintInt(sum.x);
|
||||
PrintLine("");
|
||||
PrintLine("y = ");
|
||||
PrintInt(sum.y);
|
||||
PrintLine("");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user