// Comptime compiler API — welded compiler FUNCTIONS over the host-call bridge.
//
// `intern` / `text_of` are bound to the `compiler` library via
// `abi(.compiler)`. They have no real symbol — under the comptime
// interpreter the call dispatches to the compiler's registered Zig handler
// (the string pool), never dlsym. Comptime-only: here they run inside `#run`,
// folding to a plain string constant the runtime `main` prints.
//
// Round-trip: `text_of(intern(s)) == s` — interning a string yields a handle,
// and resolving the handle gives the text back.

#import "modules/std.sx";


StringId :: u32;
intern  :: (s: string) -> StringId abi(.compiler);
text_of :: (id: StringId) -> string abi(.compiler);

greeting :: #run text_of(intern("hello, compiler"));

main :: () {
    print("{}\n", greeting);
}
