- objc.sx, objc_block.sx (from std/) + sdl3/opengl/raylib/stb/stb_truetype/ wasm vendor bindings (from modules/ root) -> modules/ffi/ - std/uikit.sx deleted: platform/uikit.sx already declares UIApplicationMain and imports objc; '#framework "UIKit"' cannot live in a file imported on macOS targets (unconditional link directive, UIKit is iOS-only), so the three iOS-only examples carry the 3-line glue inline. 1607/1608/1616 also un-rotted (dead ns_string -> 'xx "..."' Into conversions, callconv(.c) msgSend fn-ptrs) — all three build for ios-sim/ios again. - math/math.sx -> math/scalar.sx; one spelling '#import "modules/math"' everywhere (4 pinned IR snapshots regenerated: dir import adds Vec2/Mat4 to the type tables). - compiler.sx -> build.sx (imports, CLAUDE.md bundling table, specs.md). - testpkg/ + test_c.sx -> tests/fixtures/ (resolve CWD-relative from repo root, same as vendors/). - library-internal imports use full modules/... paths (std.sx tail, platform/bundle.sx, fixtures).
43 lines
1.4 KiB
Plaintext
43 lines
1.4 KiB
Plaintext
#import "modules/std.sx";
|
|
#import "modules/math";
|
|
#import "modules/build.sx";
|
|
#import "modules/std/test.sx";
|
|
pkg :: #import "tests/fixtures/testpkg";
|
|
|
|
main :: () {
|
|
|
|
// --- UFCS Aliases & Pipe ---
|
|
{
|
|
print("=== UFCS Aliases ===\n");
|
|
|
|
num_sum :: (a: s64, b: s64) -> s64 { a + b }
|
|
sum :: ufcs num_sum;
|
|
|
|
print("{}\n", num_sum(40, 2)); // 42 — direct call
|
|
print("{}\n", sum(40, 2)); // 42 — alias direct call
|
|
print("{}\n", 40 |> sum(2)); // 42 — pipe UFCS via alias
|
|
|
|
print("{}\n", num_sum(40, 2)); // 42 — direct (was tuple full-splat)
|
|
print("{}\n", 40 |> sum(2)); // 42 — pipe (was tuple partial-splat)
|
|
|
|
compute :: (a: s64, b: s64, c: s64, d: s64) -> s64 { a + b * c - d }
|
|
calc :: ufcs compute;
|
|
|
|
print("{}\n", compute(1, 2, 3, 4)); // 1+2*3-4 = 3 (was tuple full-splat)
|
|
print("{}\n", compute(1, 2, 3, 4)); // same = 3 (was tuple partial-splat)
|
|
print("{}\n", 1 |> calc(2, 3, 4)); // same = 3 — pipe UFCS
|
|
|
|
// Tuple return type
|
|
swap :: (a: s64, b: s64) -> (s64, s64) { (b, a) }
|
|
s := swap(1, 2);
|
|
a := s.0;
|
|
b := s.1;
|
|
print("{}\n", a); // 2
|
|
print("{}\n", b); // 1
|
|
|
|
wrap :: (x: s64) -> (s64) { (x,) }
|
|
t := wrap(99);
|
|
print("{}\n", t.0); // 99
|
|
}
|
|
}
|