ส่ง
Translation status: ภาษาไทย reader-locale proof. Term names and code fences follow the th-TH pack; supporting prose may still be English.
live outbound and inbound ช่องทาง directional views
Syntax:
Category#
endpoint
Related#
- ถึง
- ช่องทาง
- รับ
- scrinium
- เคอร์เซอร์
- accipe
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: ถึง, ช่องทาง, รับ, เฟรม, เคอร์เซอร์, accipe
# =============================================================================
# Live `ส่ง<T>` / `รับ<T>` directional views
#
# runtime:echo returns one inbound ข้อความ frame per conversation.
# accipe, เคอร์เซอร์, 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
}