渲染zh-Hant

async tempus dormiet

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

Async tempus.sleep_async and sync tempus.sleep share the tempus:dormiet route.

Syntax: tempus.sleep(ms) | 等棄 tempus.sleep_async(ms)

Category#

ad

Examples#

radix/corpus/ad/async-tempus-dormiet.fab (canonical · concept)#

Async tempus.sleep_async and sync tempus.sleep share the tempus:dormiet route.

# =============================================================================
# async tempus dormiet — async tempus.sleep_async and sync tempus.sleep share
# the tempus:dormiet route.
# =============================================================================
#
# What this teaches:
#   • Timer proof pair — `expectet` (sync) and `dormiet` (async) use the same
#     `tempus:dormiet` route; caller posture selects the materializer
#   • Async entry — `非同步入口 { … }` is the async program entry point
#
# Common mistakes:
#   • confusing 端點 route syntax — `等棄` awaits and discards async completion
#
# See also: 端點, tempus, 未來, 通道
# =============================================================================

# Timer proof pair for async `端點` materialization.
#
# `expectet` is the synchronous wrapper and `dormiet` is the async wrapper.
# Norma currently declares the async wrapper with compatibility `@ 未來`; this
# example consumes it through `等棄`.

import from "norma:time" tempus

async_main {
    tempus.sleep(0)
    await tempus.sleep_async(0)
    assert true
}