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 @@
|
||||
// Pattern Matching - Match expressions with algebraic enums
|
||||
extern func Std_Io_PrintLine(s: String);
|
||||
extern func Std_Io_PrintInt(n: int);
|
||||
import Std::Io::{PrintLine, PrintInt};
|
||||
|
||||
|
||||
enum Option {
|
||||
Some(int),
|
||||
@@ -20,13 +20,13 @@ func Main() -> int {
|
||||
|
||||
let opt2: Option = Option { tag: Option_None };
|
||||
|
||||
Std_Io_PrintLine("opt1 value: ");
|
||||
Std_Io_PrintInt(GetValue(opt1));
|
||||
Std_Io_PrintLine("");
|
||||
PrintLine("opt1 value: ");
|
||||
PrintInt(GetValue(opt1));
|
||||
PrintLine("");
|
||||
|
||||
Std_Io_PrintLine("opt2 value: ");
|
||||
Std_Io_PrintInt(GetValue(opt2));
|
||||
Std_Io_PrintLine("");
|
||||
PrintLine("opt2 value: ");
|
||||
PrintInt(GetValue(opt2));
|
||||
PrintLine("");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user