Parent: #13
Implement the local coroutine channel primitive described in the parent proposal.
Required API:
local ch = async.channel({ capacity = 32 })
ch:send(value)
ch:trySend(value)
ch:recv()
ch:tryRecv()
ch.handler = function(value) end
for value in ch do end
ch:close()
ch:isClosed()
Acceptance criteria:
- Bounded FIFO queue.
send suspends when full.
trySend never suspends.
recv suspends when empty.
tryRecv never suspends.
- Handler and iterator are alternative consumers.
- Close drains queued values and wakes suspended operations.
- Values are safely snapshotted.
- Tests cover full, empty, closed, and concurrent behavior.
Parent: #13
Implement the local coroutine channel primitive described in the parent proposal.
Required API:
Acceptance criteria:
sendsuspends when full.trySendnever suspends.recvsuspends when empty.tryRecvnever suspends.