渲染zh-Hans

等定

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

Awaits a 期约 and binds an immutable name.

Aliases: await_const

Syntax: 等定 T name ← future

Category#

async

Examples#

radix/corpus/figendum/figendum.fab (canonical · keyword)#

Awaits a 期约 and binds an immutable name.

# =============================================================================
# 等定 — Await-bind immutable
# =============================================================================
#
# What this teaches:
#   • Await a `期约<T>` and bind the success value immutably.
#   • Valid in `异步` / `异流` / `异步入口` contexts.
#
# See also: 等变, 等弃, 等返, 异步, 期约
# =============================================================================

# GRAMMAR:
#   awaitBind :← '等定' type? IDENT '←' expr

函数 responde() 异步 → 整数 {
    返回 7
}

异步入口 {
    等定 整数 responsum ← responde()
    显示 responsum
}

Expected output:

7