Kết xuấtvi

bắt_đầu_bất_đồng_bộ

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

Declares the asynchronous program entry point.

Syntax: bắt_đầu_bất_đồng_bộ <block>

Category#

entry

Examples#

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

Declares the asynchronous program entry point.

# =============================================================================
# bắt_đầu_bất_đồng_bộ — Declares the asynchronous program entry point
# =============================================================================
#
# What this teaches:
#   • Declares the asynchronous program entry point.
#   • Related keywords: bắt_đầu, đợi_hằng, đợi_bỏ
#
# Common mistakes:
#   • Calling a `async` function without consuming its lời_hứa; use
#     `đợi_hằng`, `đợi_biến`, `đợi_trả`, or `đợi_bỏ` inside an `bắt_đầu_bất_đồng_bộ`.
#
# See also: bắt_đầu, đợi_hằng, đợi_bỏ
# =============================================================================

# bắt_đầu_bất_đồng_bộ — async program entry point
#
# bắt_đầu_bất_đồng_bộ { <body> }
#
# GRAMMAR:
#   asyncEntry :← 'bắt_đầu_bất_đồng_bộ' block
#
# EXPECTED OUTPUT:
#   none — Rust async runtime whitelist (compile-only in harness)
#
# BACKEND:
#   Pairs with `async` and awaited bindings; contrast with bắt_đầu
#   (synchronous entry).

# Helper async finite function
fn accipe() async → string {
    # Simulates async finite operation
    return "datum paratum"
}

fn metire(string datum) async → int {
    return datum.length()
}

# Futura entry point
async_main {
    print "incipiet initium"

    # Await async functions with đợi_hằng
    await_const string datum ← accipe()
    print "acceptum: §"(datum)
    await_const int longitudo ← metire(datum)
    print "longitudo: §"(longitudo)
    print "opus perfectum"
}

Expected output:

incipiet initium
acceptum: datum paratum
longitudo: 13
opus perfectum