Renderingen-US

send

Translation status: English reader-locale proof. Term names and code fences follow the en pack; supporting prose may still be English.

live outbound and inbound channel directional views

Syntax:

Category#

endpoint

Examples#

radix/corpus/ad/sermo-live-directional.fab (canonical · method)#

live outbound and inbound channel directional views

# =============================================================================
# send — live outbound and inbound channel directional views.
# =============================================================================
#
# What this teaches:
#   • Directional channel views — `send<T>` for outbound frames, `recv<T>` for
#     inbound frames on a channel connection
#   • Cursor iteration — `for from t.cursor()` consumes inbound frames
#   • Accipe reception — `accipe()` pulls a single frame from the inbound
#     queue
#
# Common mistakes:
#   • confusing `send` (outbound) and `recv` (inbound) channel directional views, or mixing accipe/cursor/exhauri without intentional ordered consumption
#
# See also: call, channel, recv, frame, cursor, accipe
# =============================================================================

# Live `send<T>` / `recv<T>` directional views
#
# runtime:echo returns one inbound string frame per conversation.
# accipe, cursor, and exhauri may share one recv queue; mix them only when
# ordered consumption is intentional.

main {
    const channel s ← call 'runtime:echo' ("salve")
    const send<string> m ← s.meus<string>()
    m.da("ping")
    const status outbound ← m.fini()
    const recv<string> t ← s.tuus<string>()
    for from t.cursor() const frame {
        assert frame.data ≡ "salve"
    }
    const status inbound ← t.fini()
    const channel s2 ← call 'runtime:echo' ("salve")
    const recv<string> t2 ← s2.tuus<string>()
    const frame<string> ∪ none got ← t2.accipe()
    const status accipe_done ← t2.fini()
    print outbound
    print inbound
    print got
    print accipe_done
}