002 string ownership

✓ Passing This code compiles and runs correctly.

Code

// Test: String ownership transitions and append
~import "$std/string"
~import "$std/io"

~std.string:from_page(text: "hello")
| ok s |> std.string:take(s: s.s)
    | instance owned |> std.string:append(s: owned, text: " world")
        | ok |> std.string:read(s: owned)
            | slice text |> std.io:print.ln("{{ text:s }}")
                |> std.string:free(s: owned)
        | err _ |> std.string:free(s: owned)
| err _ |> _
input.kz

Expected Output

hello world

Test Configuration

MUST_RUN