Kết xuấtvi

tương_lai

Translation status: Tiếng Việt reader-locale proof. Term names and code fences follow the vi pack; supporting prose may still be English.

Compatibility annotation for asynchronous posture.

Syntax: @ tương_lai

Category#

async

Examples#

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

Braced canonical @ tương_lai 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.

# =============================================================================
# tương_lai — Compatibility annotation for asynchronous posture
# =============================================================================
#
# What this teaches:
#   • Preferred async posture — write `async` for a finite async function.
#   • Compatibility annotation — `@ tương_lai` remains accepted and preserved as
#     the legacy spelling for async posture.
#   • Related keywords: con_trỏ, đợi_hằng, đợi_bỏ
#
# Common mistakes:
#   • Calling an async function and forgetting to consume the lời_hứa with
#     `đợi_hằng`, `đợi_biến`, `đợi_trả`, or `đợi_bỏ`.
#
# See also: con_trỏ, đợi_hằng, đợi_bỏ
# =============================================================================

# @ tương_lai — compatibility async function annotation
#
# @ tương_lai
# hàm tên(…) → kiểu_tên { … }
#
# GRAMMAR:
#   annotatedFunc :← '@' 'tương_lai' funcDecl
#   callablePosture :← 'async'
#
# EXPECTED OUTPUT:
#   none — Rust async runtime whitelist (compile-only in harness)
#
# BACKEND:
#   Rust async runtime not linked in exempla harness (whitelist: tương_lai/futura.fab).

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

async_main {
    # đợi_hằng awaits the lời_hứa and binds the resolved value
    await_const int responsum ← responde()
    print responsum
}

Expected output:

42