(rontolisp) docs
← Special Forms

rontolisp:async

(rontolisp:async (defun name (params...) body...)) / (rontolisp:async (lambda (params...) body...))

Wraps an ordinary defining form and turns it into its asynchronous counterpart, for a notation closer to JavaScript's async function / async (...) =>. Wrapping a defun is exactly rontolisp:async-defun, and wrapping a lambda is exactly rontolisp:async-lambda — the wrapper is a pure rewrite, so the semantics (eager start, futures, rontolisp:await placement) and the backend support are those of the canonical forms.

Anything other than a single defun or lambda form inside the wrapper is an error:

> (rontolisp:async (+ 1 2))
Error: rontolisp:async expects a single (defun ...) or (lambda ...) form to make asynchronous, got: (rontolisp:async (+ 1 2))