✓
Passing This code compiles and runs correctly.
Code
// 696_004 — std/ctx inside a tor's own body: the scope is lexical, so a
// `ctx` step in an impl body injects there exactly as at flow top level.
// A nullary tor wrapping a scoped chain is also the partial-application
// spelling: `local` is a callable that captured a context, invocable
// from anywhere.
import std/io
import std/store
import std/ctx
std/store:new(inner) { a: 9[i64], b: 8[i64], c: 7[i64] }
pub tor ctxprobe { a: i64, b: i64, c: i64 }
ctxprobe = std/io:print.ln("ctxprobe a={{ a:d }} b={{ b:d }} c={{ c:d }}")
pub tor local { }
local = std/ctx(inner) |> ctxprobe()
std/io:print.ln("seed")
|> local()
Actual
seed
ctxprobe a=9 b=8 c=7
Expected output
seed
ctxprobe a=9 b=8 c=7
Flows
flow ~new click a branch to expand · @labels scroll to their anchor
new (inner, source: a: 9[i64], b: 8[i64], c: 7[i64])
subflow ~ctxprobe click a branch to expand · @labels scroll to their anchor
print.ln (expr: "ctxprobe a={{ a:d }} b={{ b:d }} c={{ c:d }}")
subflow ~local click a branch to expand · @labels scroll to their anchor
std/ctx (inner)
flow ~print.ln click a branch to expand · @labels scroll to their anchor
print.ln (expr: "seed")
Test Configuration
MUST_RUN LANGUAGES: zig