العرضar

إرسال

Translation status: العربية reader-locale proof. Term names and code fences follow the ar pack; supporting prose may still be English.

live outbound and inbound قناة directional views

Syntax:

Category#

endpoint

Examples#

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

live outbound and inbound قناة directional views

# =============================================================================
# إرسال — live outbound and inbound قناة directional views.
# =============================================================================
#
# What this teaches:
#   • Directional قناة views — `إرسال<T>` for outbound frames, `استقبال<T>` for
#     inbound frames on a قناة connection
#   • Cursor iteration — `كرر من t.cursor()` consumes inbound frames
#   • Accipe reception — `accipe()` pulls a single إطار from the inbound
#     طابور
#
# Common mistakes:
#   • confusing `إرسال` (outbound) and `استقبال` (inbound) قناة directional views, or mixing accipe/cursor/exhauri without intentional ordered consumption
#
# See also: اتصل, قناة, استقبال, إطار, cursor, accipe
# =============================================================================

# Live `إرسال<T>` / `استقبال<T>` directional views
#
# runtime:echo returns one inbound نص frame per conversation.
# accipe, cursor, and exhauri may share one استقبال طابور; mix them only when
# ordered consumption is intentional.

main {
    const قناة s ← call 'runtime:echo' ("salve")
    const إرسال<string> m ← s.meus<string>()
    m.da("ping")
    const status outbound ← m.fini()
    const استقبال<string> t ← s.tuus<string>()
    for from t.cursor() const frame {
        assert frame.data ≡ "salve"
    }
    const status inbound ← t.fini()
    const قناة s2 ← call 'runtime:echo' ("salve")
    const استقبال<string> t2 ← s2.tuus<string>()
    const إطار<string> ∪ none got ← t2.accipe()
    const status accipe_done ← t2.fini()
    print outbound
    print inbound
    print got
    print accipe_done
}