Surface rename of the signed integer family: s1..s64 become i1..i64
(u1..u64, usize, isize unchanged). 'string' keeps the s-prefix arm in
name classification; width parsing moves to the i-prefix arm next to
isize.
Internal TypeId tags follow the surface (.s8/.s16/.s32/.s64 ->
.i8/.i16/.i32/.i64), as do mono-key mangle fragments (ptr_i64,
tu_i64_bool) and all display/diagnostic formatting (i{d}).
Migrated in the same sweep: stdlib + examples + issue repros + FFI C
companions (shared symbol names like ffi_id_i64), expected
stdout/stderr/ir snapshots, specs.md, readme.md, CLAUDE.md/AGENTS.md,
implementation_plan.md, docs/, issue writeups. Vendored stb_image and
historical flow state left untouched.
zig build test: 426/426; examples suite: 595/595.
36 lines
1.3 KiB
Plaintext
36 lines
1.3 KiB
Plaintext
// Variadic heterogeneous type packs — step 4 final slice (4A
|
|
// bare): `$args` referenced bare (without `[...]` indexing) in
|
|
// expression position should evaluate to a comptime `[]Type`
|
|
// slice value — the whole pack passed through as data so
|
|
// builder fns can walk it.
|
|
//
|
|
// Use case (eventual): step 5's generic Into(Block) impl body
|
|
// convert :: (self: Closure(..$args) -> $R) -> Block {
|
|
// #insert build_block_convert($args, $R);
|
|
// }
|
|
// where `build_block_convert(args: []Type, ret: Type) -> string`
|
|
// is a regular sx fn the interp executes — it walks `args` to
|
|
// emit a trampoline fn matching the per-mono signature.
|
|
//
|
|
// Today the parser-arm I wrote for `$<ident>[<int>]` (commit
|
|
// fd03b58, M5.A.next.4.3) REQUIRES the `[` after the pack
|
|
// name; bare `$args` hits a focused diagnostic. This file
|
|
// pins that rejection. Next commit makes the `[` optional —
|
|
// no `[` yields a `comptime_pack_ref` AST node which lowering
|
|
// converts to a `[N x Type]` aggregate of `const_type` values.
|
|
|
|
#import "modules/std.sx";
|
|
|
|
len_of :: (..$args) -> i64 {
|
|
list := $args;
|
|
return list.len;
|
|
}
|
|
|
|
main :: () -> i32 {
|
|
print("{}\n", len_of());
|
|
print("{}\n", len_of(42));
|
|
print("{}\n", len_of(1, 2, 3));
|
|
print("{}\n", len_of("a", true, 3.14, "b"));
|
|
return 0;
|
|
}
|