{ "schema": "ailang/v0", "name": "str_clone_cross_realisation", "imports": [], "defs": [ { "kind": "fn", "name": "main", "type": { "k": "fn", "params": [], "ret": { "k": "con", "name": "Unit" }, "effects": ["IO"] }, "params": [], "doc": "Iter 24.1: cross-realisation invariant for str_clone. Clones a heap-Str (produced by int_to_str 42) AND a static-Str (literal `abc`); both clones produce fresh heap-Str slabs that print their input bytes. Pins the uniform-consumer-ABI claim — str_clone only reads the len-field at offset 0 plus the bytes plus the NUL; it never consults the (absent for static-Str) rc_header. RC stats under --alloc=rc: allocs == 3 (int_to_str output + two str_clone outputs), frees == 3, live == 0.", "body": { "t": "let", "name": "src_heap", "value": { "t": "app", "fn": { "t": "var", "name": "int_to_str" }, "args": [{ "t": "lit", "lit": { "kind": "int", "value": 42 } }] }, "body": { "t": "let", "name": "c1", "value": { "t": "app", "fn": { "t": "var", "name": "str_clone" }, "args": [{ "t": "var", "name": "src_heap" }] }, "body": { "t": "let", "name": "c2", "value": { "t": "app", "fn": { "t": "var", "name": "str_clone" }, "args": [{ "t": "lit", "lit": { "kind": "str", "value": "abc" } }] }, "body": { "t": "let", "name": "_a", "value": { "t": "do", "op": "io/print_str", "args": [{ "t": "var", "name": "c1" }] }, "body": { "t": "do", "op": "io/print_str", "args": [{ "t": "var", "name": "c2" }] } } } } } } ] }