渲染zh-Hant

未來

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

Compatibility annotation for asynchronous posture.

Syntax: @ 未來

Category#

async

Examples#

radix/corpus/annotation-sugar/futura-braced.fab (canonical · annotation)#

Braced canonical @ 未來 unit marker.

@ future { }
fn f() → void {
    return
}

main {
    print "futura-braced"
}

Expected output:

futura-braced

radix/corpus/futura/futura.fab (canonical · annotation)#

Compatibility annotation for asynchronous posture.

# =============================================================================
# 未來 — Compatibility annotation for asynchronous posture
# =============================================================================
#
# What this teaches:
#   • Preferred async posture — write `異步` for a finite async function.
#   • Compatibility annotation — `@ 未來` remains accepted and preserved as
#     the legacy spelling for async posture.
#   • Related keywords: 迭代器, 等定, 等棄
#
# Common mistakes:
#   • Calling an async function and forgetting to consume the 承諾 with
#     `等定`, `等變`, `等返`, or `等棄`.
#
# See also: 迭代器, 等定, 等棄
# =============================================================================

# @ 未來 — compatibility async function annotation
#
# @ 未來
# 函式 名稱(…) → 型別 { … }
#
# GRAMMAR:
#   annotatedFunc :← '@' '未來' funcDecl
#   callablePosture :← '異步'
#
# EXPECTED OUTPUT:
#   none — Rust async runtime whitelist (compile-only in harness)
#
# BACKEND:
#   Rust async runtime not linked in exempla harness (whitelist: 未來/futura.fab).

@ future { }
fn responde() → int {
    return 42
}

async_main {
    # 等定 awaits the 承諾 and binds the resolved value
    await_const int responsum ← responde()
    print responsum
}

Expected output:

42