वादा
Translation status: हिन्दी reader-locale proof. Term names and code fences follow the hi pack; supporting prose may still be English.
Promise-like result type associated with async finite functions.
Aliases: promise
Syntax: वादा<T> | वादा<T ⇥ E>
Category#
async
Related#
Examples#
radix/corpus/promissum/promissum.fab (canonical · keyword)#
Promise-like result type associated with async finite functions.
# =============================================================================
# वादा — Promise-like result type associated with async finite functions.
# =============================================================================
#
# What this teaches:
# • Async return type — `वादा<T>` is the return-type wrapper for `async`
# functions and compatibility `@ भविष्य` functions.
# • Failable async return type — `वादा<T ⇥ E>` preserves both the
# resolved value and delayed alternate channel.
#
# Common mistakes:
# • Creating a `वादा<T>` but never awaiting it with `रुको_स्थिर`,
# `रुको_चर`, `रुको_लौटाओ`, or `रुको` — the promise goes unobserved.
#
# See also: async, भविष्य, रुको_स्थिर, रुको
# =============================================================================
# वादा<T> — async result type (paired with async)
#
# फलन … async → <प्रकार> -- lowers to वादा<<प्रकार>>
# फलन … async → <प्रकार> ⇥ E -- lowers to वादा<<प्रकार> ⇥ E>
#
# GRAMMAR:
# futuraDecl :← funcDecl 'async'
#
# EXPECTED OUTPUT:
# वादा प्रकार notus (promissum.expected).
fn compute() async → int {
return 7
}
main {
print "promissum typus notus"
}Expected output:
promissum typus notus