渲染zh-Hant

↢

Translation status: 繁體中文 reader-locale proof. Term names and code fences follow the zh-Hant pack; supporting prose may still be English.

Awaits a 承諾 while initializing an ordinary binding.

Syntax: 定值 T name ↢ future

Category#

async

Examples#

radix/corpus/await-assignment/await-assignment.fab (canonical · operator)#

Awaits a 承諾 while initializing an ordinary binding.

# =============================================================================
# ↢ — Await-directed binding initializer
# =============================================================================
#
# What this teaches:
#   • Keep 定值, 變值, or 設為 while awaiting the initializer.
#   • The glyph is a binding boundary, not an inline expression operator.
#   • A stored 承諾 can be resolved in a later declaration.
#
# See also: 等定, 等變, 異步, 承諾
# =============================================================================

函式 responde(整數 值) 異步 → 整數 {
    傳回 值
}

非同步入口 {
    定值 承諾<整數> 預期 ← responde(7)
    定值 整數 immotum ↢ 預期
    變值 整數 mutabile ↢ responde(8)
    定值 _ illatum ↢ responde(9)
    mutabile ← mutabile + 1
    註記 immotum
    註記 mutabile
    註記 illatum
}

Expected output:

7
9
9