การเรนเดอร์th-TH

เริ่มอะซิงก์

Translation status: ภาษาไทย reader-locale proof. Term names and code fences follow the th-TH pack; supporting prose may still be English.

Declares the asynchronous program entry point.

Syntax: เริ่มอะซิงก์ <block>

Category#

entry

Examples#

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

Declares the asynchronous program entry point.

# =============================================================================
# เริ่มอะซิงก์ — Declares the asynchronous program entry point
# =============================================================================
#
# What this teaches:
#   • Declares the asynchronous program entry point.
#   • Related keywords: เริ่ม, รอคง, รอทิ้ง
#
# Common mistakes:
#   • Calling a `อะซิงก์` function without consuming its คำมั่น; use
#     `รอคง`, `รอแปร`, `รอคืน`, or `รอทิ้ง` inside an `เริ่มอะซิงก์`.
#
# See also: เริ่ม, รอคง, รอทิ้ง
# =============================================================================

# เริ่มอะซิงก์ — async program entry point
#
# เริ่มอะซิงก์ { <body> }
#
# GRAMMAR:
#   asyncEntry :← 'เริ่มอะซิงก์' block
#
# EXPECTED OUTPUT:
#   none — Rust async runtime whitelist (compile-only in harness)
#
# BACKEND:
#   Pairs with `อะซิงก์` and awaited bindings; contrast with เริ่ม
#   (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 อะซิงก์ functions with รอคง
    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