diff --git a/examples/1805-concurrency-io-blocking-async.sx b/examples/1805-concurrency-io-blocking-async.sx index a422cb0e..6db7ebcd 100644 --- a/examples/1805-concurrency-io-blocking-async.sx +++ b/examples/1805-concurrency-io-blocking-async.sx @@ -18,6 +18,11 @@ main :: () { d := context.io.async((x: i64) -> i64 => x * 2, 21); print("double: {}\n", d.await() or { -1 }); + // Nullary worker — the variadic `async` binds an empty pack, so no separate + // `async_void` entry is needed. + n := context.io.async(() -> i64 => 42); + print("nullary: {}\n", n.await() or { -1 }); + // The Io capability also carries a monotonic clock. if context.io.now_ms() >= 0 { print("clock ok\n"); } } diff --git a/examples/expected/1805-concurrency-io-blocking-async.stdout b/examples/expected/1805-concurrency-io-blocking-async.stdout index ed2c2a46..db0df15f 100644 --- a/examples/expected/1805-concurrency-io-blocking-async.stdout +++ b/examples/expected/1805-concurrency-io-blocking-async.stdout @@ -1,3 +1,4 @@ sum: 42 double: 42 +nullary: 42 clock ok diff --git a/library/modules/std.sx b/library/modules/std.sx index 0401fc70..972b53a8 100644 --- a/library/modules/std.sx +++ b/library/modules/std.sx @@ -97,7 +97,6 @@ Future :: io_mod.Future; FutureState :: io_mod.FutureState; IoErr :: io_mod.IoErr; async :: io_mod.async; -async_void :: io_mod.async_void; await :: io_mod.await; cancel :: io_mod.cancel; // `timeout` / `Future(void)` are DEFERRED (B1.4) pending issue 0150 diff --git a/library/modules/std/io.sx b/library/modules/std/io.sx index 2d5f977b..55b2c764 100644 --- a/library/modules/std/io.sx +++ b/library/modules/std/io.sx @@ -107,14 +107,9 @@ async :: ufcs (io: Io, worker: Closure(..$args) -> $R, ..$args) -> Future($R) { return f; } -// Nullary form — no args. A worker that takes no arguments. -async_void :: ufcs (io: Io, worker: Closure() -> $R) -> Future($R) { - f : Future($R) = ---; - f.value = worker(); - f.state = .ready; - f.canceled = Atomic(bool).init(false); - return f; -} +// (A nullary worker needs no separate entry: the variadic `async` above binds +// `..$args` to the empty pack, so `context.io.async(() -> $R => …)` calls +// `worker()` and returns `Future($R)`. Locked by examples/1805.) // `await(f)` — value-carrying failable. `.ready` → the result; `.failed` // / `.canceled` → raise the stored / cancellation error.