Renderingen-US

Experimental through version 1. Version 0 was alpha. This is the first language release: the interface is relatively stable, not frozen. Nothing is promised stable until version 2.

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/reference/method/meus/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>` (explain term `send`) for outbound
#     frames, `recv<T>` (`recv`) for inbound frames on a channel connection
#   • Cursor iteration — `for from t.cursor()` consumes inbound frames
#   • Single reception — `get()` (explain term `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.
# get, cursor, and drain may share one recv queue; mix them only when
# ordered consumption is intentional.

main {
    let channel s ← call 'runtime:echo' ("salve")
    let send<string> m ← s.send<string>()
    m.sink("ping")
    let status outbound ← m.finish()
    let recv<string> t ← s.recv<string>()
    for from t.cursor() let frame {
        assert frame.data ≡ "salve"
    }
    let status inbound ← t.finish()
    let channel s2 ← call 'runtime:echo' ("salve")
    let recv<string> t2 ← s2.recv<string>()
    let frame<string> ∪ none got ← t2.get()
    let status accipe_done ← t2.finish()
    print outbound
    print inbound
    print got?.data
    print accipe_done
}

Expected output:

status.done
status.done
salve
status.done