// Variadic heterogeneous type packs — follow-up #4 (runtime // pack indexing). // // `args[]` substitutes through `pack_arg_nodes` (step // 2a.B). But `args[]` — a loop counter, an // expression — falls through to the standard slice-indexing // path, which fails because the pack-mono doesn't materialise // the `args` slice. Output today: "unresolved 'args'". // // Pairs with follow-up #3: the same `[]Any` slice // materialisation handles both `args` bare and `args[i]` // runtime. Element type becomes `Any` (lossy on per-position // types — that's the inherent trade-off of runtime indexing // into a heterogeneous pack). #import "modules/std.sx"; count_anys :: (..$args) -> s64 { total : s64 = 0; i : s64 = 0; while i < args.len { // Runtime index — should resolve through the // materialised slice once #3+#4 lands. x : Any = args[i]; _ = x; total = total + 1; i = i + 1; } return total; } main :: () -> s32 { print("{}\n", count_anys(10, "hi", 2.5, true)); return 0; }