✓
Passing This code compiles and runs correctly.
Code
// A `.k` contract and its `.kz` implementation are ONE module.
//
// `compute` is declared ONLY in contract.k. The proc implementing it lives
// ONLY in contract.kz. For this call site to resolve, the resolver must load
// every companion sharing the stem `contract`, not stop at the first hit its
// extension probe order reaches.
//
// That matters beyond this test: a program whose Koru and Zig share one file
// must write `` on every Koru line, because the parser really is sitting in
// the host language. Split along this seam and the declarative half has no
// host language in it, so the character is not needed anywhere in it.
import std/io
import app/contract
app/contract:compute(x: 42): v |> std/io:print.ln("{{ v:d }}")
Supporting Files
// The contract facet: a public event signature and no host body, in a `.k`.
// Its implementation lives in the sibling `contract.kz`, and the two files —
// same stem, different Koru extension — are ONE module named `contract`.
//
// This is the layout that keeps `` out of the code a reader reads: everything
// declarative here, with no host language to switch away from, and the Zig
// confined to the companion.
pub tor compute { x: u32 } -> u32
// The implementation facet: the proc body only. The event it implements is
// declared in the sibling contract.k, and the resolver must load BOTH files
// into the module for this proc to have anything to attach to.
//
// `compute` has a bare return (`-> u32`), so the proc returns the value
// itself — a branch constructor would name an outcome the signature does not
// declare.
const std = @import("std");
~proc compute|zig {
return x + 100;
}
Actual
142
Must succeed:
Compile and run without errors.
Expected output
142
Flows
flow ~compute click a branch to expand · @labels scroll to their anchor
compute (x: 42)
Test Configuration
MUST_RUN
koru.json:
{
"paths": {
"std": "../../../../../koru_std",
"app": "."
}
}