渲染zh-Hans

未来

Translation status: 简体中文 reader-locale proof. Term names and code fences follow the zh-Hans 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