渲染zh-Hant

異步

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

Callable posture for asynchronous finite functions.

Aliases: async

Syntax: 函式 name(…) 異步 → T

Category#

async

Examples#

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

Callable posture for asynchronous finite functions.

# =============================================================================
# 異步 — Asynchronous finite callable posture
# =============================================================================
#
# What this teaches:
#   • Preferred async posture word after the parameter list: `異步 → T`.
#   • Return type is observed as `承諾<T>` at call sites.
#   • Consume with `等定`, `等變`, `等返`, or `等棄`.
#
# Common mistakes:
#   • Using bare `讓出` to await — await is not yield; use await morphology.
#
# See also: 未來, 承諾, 等定, 等棄
# =============================================================================

# GRAMMAR:
#   callablePosture :← '異步'
#
# EXPECTED OUTPUT:
#   42

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

非同步入口 {
    等定 _ responsum ← responde()
    註記 responsum
}

Expected output:

42