{ "schema": "ailang/v0", "name": "bool_to_str_drop_rc", "imports": [], "defs": [ { "kind": "fn", "name": "main", "type": { "k": "fn", "params": [], "ret": { "k": "con", "name": "Unit" }, "effects": ["IO"] }, "params": [], "doc": "Iter 24.1: pin that `bool_to_str` participates in RC discipline. Bind the heap-Str result to `s`, consume `s` once in `io/print_str`, let the binder drop at scope close. Under --alloc=rc with AILANG_RC_STATS=1 the atexit summary must report allocs == 1 && frees == 1 && live == 0 — the heap-Str slab allocated by str_alloc inside ailang_bool_to_str rides the same rc_header + ailang_rc_dec path as int_to_str.", "body": { "t": "let", "name": "s", "value": { "t": "app", "fn": { "t": "var", "name": "bool_to_str" }, "args": [{ "t": "lit", "lit": { "kind": "bool", "value": true } }] }, "body": { "t": "do", "op": "io/print_str", "args": [{ "t": "var", "name": "s" }] } } } ] }