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.
32 lines
1.2 KiB
Plaintext
32 lines
1.2 KiB
Plaintext
// `log.sx` leveled logging + the `is_comptime()` builtin (ERR step E4.1,
|
|
// slice 1). `log.{warn,info,err,debug}` interpolate like `print` and write
|
|
// `LEVEL: <msg>` to stderr. `is_comptime()` is `true` under `#run` (the
|
|
// comptime interpreter) and folds to `false` in compiled code, so a gated
|
|
// branch dead-codes out of the runtime binary.
|
|
//
|
|
// (`log.error` is spelled `log.err` — `error` is a reserved keyword. The
|
|
// `process.exit` / `assert` part of E4.1 is blocked on `noreturn` codegen,
|
|
// issue 0058.)
|
|
//
|
|
// The test runner merges stderr+stdout; the log lines (stderr) precede the
|
|
// single stdout line. Expected exit code: 0.
|
|
|
|
#import "modules/std.sx";
|
|
log :: #import "modules/std/log.sx";
|
|
|
|
probe :: () -> i32 {
|
|
if is_comptime() { return 1; } // comptime interpreter path
|
|
return 2; // compiled-code path
|
|
}
|
|
|
|
CT :: #run probe(); // folds to 1 (run in the interpreter)
|
|
|
|
main :: () -> i32 {
|
|
log.warn("disk {}% full", 91);
|
|
log.info("user {} connected", "alice");
|
|
log.err("bad fd {}", 7);
|
|
log.debug("trace x={}", 42);
|
|
print("[stdout] is_comptime runtime={} comptime={}\n", probe(), CT);
|
|
return 0;
|
|
}
|